Skip to content

Commit 069e63b

Browse files
t3dotggclaude
andauthored
fix(web): VCS status refresh no longer trips the slow-request toast (pingdotgg#22159)
Co-authored-by: Claude Opus 5.5 <[email protected]>
1 parent 4836fa7 commit 069e63b

2 files changed

Lines changed: 22 additions & 16 deletions

File tree

‎apps/web/src/rpc/requestLatencyState.test.ts‎

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -80,20 +80,23 @@ describe("requestLatencyState", () => {
8080
expect(getSlowRpcAckRequests()).toEqual([]);
8181
});
8282

83-
it("gives provider updates a longer threshold before warning", () => {
84-
trackRpcRequestSent("1", WS_METHODS.serverUpdateProvider, "server.updateProvider · env-1");
85-
vi.advanceTimersByTime(LONG_RUNNING_RPC_ACK_THRESHOLD_MS - 1);
86-
expect(getSlowRpcAckRequests()).toEqual([]);
83+
it.each([WS_METHODS.serverUpdateProvider, WS_METHODS.vcsRefreshStatus])(
84+
"gives %s a longer threshold before warning",
85+
(method) => {
86+
trackRpcRequestSent("1", method, `${method} · env-1`);
87+
vi.advanceTimersByTime(LONG_RUNNING_RPC_ACK_THRESHOLD_MS - 1);
88+
expect(getSlowRpcAckRequests()).toEqual([]);
8789

88-
vi.advanceTimersByTime(1);
89-
expect(getSlowRpcAckRequests()).toMatchObject([
90-
{
91-
requestId: "1",
92-
tag: "server.updateProvider · env-1",
93-
thresholdMs: LONG_RUNNING_RPC_ACK_THRESHOLD_MS,
94-
},
95-
]);
96-
});
90+
vi.advanceTimersByTime(1);
91+
expect(getSlowRpcAckRequests()).toMatchObject([
92+
{
93+
requestId: "1",
94+
tag: `${method} · env-1`,
95+
thresholdMs: LONG_RUNNING_RPC_ACK_THRESHOLD_MS,
96+
},
97+
]);
98+
},
99+
);
97100

98101
it("evicts the oldest pending requests once the tracker reaches capacity", () => {
99102
for (let index = 0; index < MAX_TRACKED_RPC_ACK_REQUESTS + 1; index += 1) {

‎apps/web/src/rpc/requestLatencyState.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@ import { appAtomRegistry } from "./atomRegistry";
66

77
export const SLOW_RPC_ACK_THRESHOLD_MS = 15_000;
88
/**
9-
* Some requests are slow by design — they shell out to a package manager on the
10-
* server and only respond once the install finishes. Warning about those after
11-
* 15s is noise, so they get a much longer leash.
9+
* Some requests are slow by design. Provider and server updates shell out to a
10+
* package manager and only respond once the install finishes. A VCS status
11+
* refresh fetches, may auto-pull, looks up the pull request, and first waits for
12+
* any background refresh of the same repository, which often totals over 15s.
13+
* Warning about those after 15s is noise, so they get a much longer leash.
1214
*/
1315
export const LONG_RUNNING_RPC_ACK_THRESHOLD_MS = 120_000;
1416
export const MAX_TRACKED_RPC_ACK_REQUESTS = 256;
@@ -33,6 +35,7 @@ const longRunningRpcAckMethods = new Set<string>([
3335
WS_METHODS.serverUpdateProvider,
3436
WS_METHODS.serverRefreshProviders,
3537
WS_METHODS.serverUpdateServer,
38+
WS_METHODS.vcsRefreshStatus,
3639
]);
3740

3841
const slowRpcAckRequestsAtom = Atom.make<ReadonlyArray<SlowRpcAckRequest>>([]).pipe(

0 commit comments

Comments
 (0)