Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): reconnect automation hosts after stream eviction #12343

Closedwaffleflopper(GitHub profile, opens in a new tab)wants to merge 3 commits intomain fromrefs/pull/12343/headopened View on GitHub

Showing 3 changed files with 131 additions and 4 deletions.

x
0 of 3 viewed, 3 left
107 additions and 1 deletionpackages/client-runtime/src/rpc/client.test.tsModified
View file
@@ -319,7 +319,11 @@
} as unknown as WsRpcProtocolClient;
const { activeSession, retryCount, supervisor } = yield* makeHarness();
​
- const subscriptionFiber = yield* subscribe(WS_METHODS.subscribeTerminalEvents, {}).pipe(
+ const subscriptionFiber = yield* subscribe(
+ WS_METHODS.subscribeTerminalEvents,
+ {},
+ { resubscribeOnEndAfter: "250 millis" },
+ ).pipe(
Stream.runDrain,
Effect.provideService(EnvironmentSupervisor.EnvironmentSupervisor, supervisor),
Effect.forkChild,
@@ -328,6 +332,8 @@
for (let attempt = 0; attempt < 100 && subscriptions.length < 1; attempt += 1) {
yield* Effect.yieldNow;
+ yield* TestClock.adjust("1 second");
+ expect(subscriptions).toEqual(["first"]);
yield* SubscriptionRef.set(activeSession, Option.none());
yield* SubscriptionRef.set(activeSession, Option.some(session(secondClient)));
​
@@ -341,6 +347,105 @@
}),
​
+ it.effect.each(["completed", "interrupted"] as const)(
+ "reopens a %s automation stream after a delay without replacing its session",