Skip to content

Commit 2ab188f

Browse files
fix: ignore pull request actions in latency tracker (#6476)
Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com>
1 parent 9513e62 commit 2ab188f

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

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

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ describe("requestLatencyState", () => {
5959
expect(getSlowRpcAckRequests()).toEqual([]);
6060
});
6161

62+
it.each(Object.values(WS_METHODS).filter((method) => method.startsWith("pullRequests.")))(
63+
"ignores pull request workspace request %s",
64+
(method) => {
65+
trackRpcRequestSent("1", method);
66+
vi.advanceTimersByTime(SLOW_RPC_ACK_THRESHOLD_MS * 2);
67+
68+
expect(getSlowRpcAckRequests()).toEqual([]);
69+
},
70+
);
71+
6272
it("keeps ignoring untracked methods when a display tag is supplied", () => {
6373
trackRpcRequestSent(
6474
"1",

apps/web/src/rpc/requestLatencyState.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ function getSlowRpcAckRequestsValue(): ReadonlyArray<SlowRpcAckRequest> {
4949
}
5050

5151
function shouldTrackRpcAck(method: string): boolean {
52-
return !method.includes("subscribe") && !untrackedRpcAckMethods.has(method);
52+
return (
53+
!method.includes("subscribe") &&
54+
!method.startsWith("pullRequests.") &&
55+
!untrackedRpcAckMethods.has(method)
56+
);
5357
}
5458

5559
function rpcAckThresholdMs(method: string): number {

0 commit comments

Comments
 (0)