Skip to content

Commit c6427fc

Browse files
fix(client-runtime): report preparing as soon as a connection attempt starts
Route checks can hold the first route for up to 2.5s; the per-route report alone left the previous connected or backoff state showing meanwhile. AI-assisted; verified with the tests and tools listed above.
1 parent 7295fbe commit c6427fc

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

‎packages/client-runtime/src/connection/driver.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,13 @@ describe("ConnectionDriver", () => {
6262
.connect(ENTRY, (progress) => Ref.update(stages, (all) => [...all, progress.stage]))
6363
.pipe(Effect.scoped, Effect.flip);
6464

65-
expect(yield* Ref.get(stages)).toEqual(["preparing", "opening", "preparing", "opening"]);
65+
expect(yield* Ref.get(stages)).toEqual([
66+
"preparing",
67+
"preparing",
68+
"opening",
69+
"preparing",
70+
"opening",
71+
]);
6672
}),
6773
);
6874
});

‎packages/client-runtime/src/connection/driver.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ export const make = Effect.gen(function* () {
194194
"connection.target.kind": target._tag,
195195
"connection.route.count": connectionRoutes(entry).length,
196196
});
197+
yield* reportProgress({ stage: "preparing" });
197198
return yield* connectOverRoutes(
198199
entry,
199200
(route) => checkRoute(entry, route),

‎packages/client-runtime/src/connection/supervisor.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,7 @@ const makeHarness = Effect.fn("TestConnectionHarness.make")(function* (options?:
244244
entry: ConnectionCatalogEntry,
245245
reportProgress: (progress: ConnectionDriver.ConnectionDriverProgress) => Effect.Effect<void>,
246246
) {
247+
yield* reportProgress({ stage: "preparing" });
247248
return yield* ConnectionDriver.connectOverRoutes(entry, checkRoute, (route) =>
248249
connectRoute(route.target, reportProgress),
249250
);

0 commit comments

Comments
 (0)