Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client-runtime): tolerate transient foreground probe timeouts #8522

ClosedRadu028(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/8522/headopened View on GitHub

Showing 2 changed files with 102 additions and 9 deletions.

x
0 of 2 viewed, 2 left
67 additions and 2 deletionspackages/client-runtime/src/connection/supervisor.test.tsModified
View file
@@ -994,10 +994,19 @@
}).pipe(Effect.provide(TestClock.layer())),
​
- it.effect("uses the full tolerance window for a stalled desktop foreground probe", () =>
+ it.effect("reconnects only after consecutive desktop foreground probe timeouts", () =>
Effect.gen(function* () {
+ const firstProbeStarted = yield* Deferred.make<void>();
+ const secondProbeStarted = yield* Deferred.make<void>();
+ const probeCount = yield* Ref.make(0);
const harness = yield* makeHarness({
- probe: (attempt) => (attempt === 1 ? Effect.never : Effect.void),
+ probe: () =>
+ Ref.updateAndGet(probeCount, (count) => count + 1).pipe(
+ Effect.tap((count) =>
+ Deferred.succeed(count === 1 ? firstProbeStarted : secondProbeStarted, undefined),
+ ),
+ Effect.andThen(Effect.never),
+ ),
const supervisor = yield* EnvironmentSupervisor.make(TARGET_ENTRY, {
initiallyDesired: true,
@@ -1005,15 +1014,71 @@
yield* awaitState(supervisor.state, (state) => state.phase === "connected");
yield* harness.wake("application-active");
+ yield* Deferred.await(firstProbeStarted);
yield* TestClock.adjust("14999 millis");
expect(yield* Ref.get(harness.sessionCount)).toBe(1);