Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

ClosedZeus-Deus(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/5198/headopened View on GitHub

Showing 2 changed files with 115 additions and 7 deletions.

x
0 of 2 viewed, 2 left
83 additions and 0 deletionspackages/client-runtime/src/connection/supervisor.test.tsModified
View file
@@ -949,6 +949,89 @@
}).pipe(Effect.provide(TestClock.layer())),
​
+ it.effect("reconnects only after consecutive foreground liveness 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: () =>
+ 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,
+ }).pipe(Effect.provide(harness.dependencies));
+​
+ yield* awaitState(supervisor.state, (state) => state.phase === "connected");
+ yield* harness.wake("application-active");
+ yield* Deferred.await(firstProbeStarted);
+ yield* TestClock.adjust("15 seconds");
+ yield* Effect.yieldNow;
+​
+ expect((yield* SubscriptionRef.get(supervisor.state)).phase).toBe("connected");
+ expect(yield* Ref.get(harness.sessionCount)).toBe(1);