Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(client): self-heal empty thread details and back off failed thread subscriptions #4405

Closedcolonelpanic8(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/4405/headopened View on GitHub

Showing 4 changed files with 147 additions and 5 deletions (loading 2).

x
0 of 4 viewed, 4 left
129 additions and 0 deletionspackages/client-runtime/src/rpc/client.test.tsModified
View file
@@ -355,6 +355,135 @@
}),
​
+ it.effect("grows the retry delay for consecutive expected failures", () =>
+ Effect.gen(function* () {
+ const domainError = new Error("thread not found yet");
+ const subscriptionCount = yield* Ref.make(0);
+ const client = {
+ [WS_METHODS.subscribeTerminalEvents]: () =>
+ Stream.unwrap(
+ Ref.update(subscriptionCount, (count) => count + 1).pipe(
+ Effect.as(Stream.fail(domainError)),
+ ),
+ ),
+ } as unknown as WsRpcProtocolClient;
+ const { activeSession, supervisor } = yield* makeHarness();
+ const awaitSubscriptions = Effect.fn("TestEnvironmentRpc.awaitSubscriptions")(function* (
+ count: number,
+ ) {
+ for (let attempt = 0; attempt < 100; attempt += 1) {
+ if ((yield* Ref.get(subscriptionCount)) >= count) {
+ return;
+ }
+ yield* Effect.yieldNow;
+ }
+ return yield* Effect.die(new Error(`Expected ${count} subscriptions.`));
+ });
+ const settle = Effect.gen(function* () {
+ for (let attempt = 0; attempt < 20; attempt += 1) {