Prevent duplicate Discord gateway wakes
Some checks failed
ci / check (push) Failing after 16s

This commit is contained in:
matamune 2026-05-14 15:50:43 +00:00
parent c43b6925bd
commit 2196f0de9b
Signed by: matamune
GPG key ID: 3BB8E7D3B968A324
2 changed files with 6 additions and 1 deletions

View file

@ -1216,7 +1216,6 @@ export class DiscordCodexBridge {
}
const wakes = this.#gatewayPendingWakes();
if (wakes.some((wake) =>
!wake.startedAt &&
wake.kind === input.kind &&
wake.groupId === input.groupId &&
sameStringSet(wake.delegationIds, delegationIds)

View file

@ -289,6 +289,9 @@ describe("DiscordCodexBridge", () => {
startedAt: "2026-05-14T12:00:00.000Z",
}),
);
await sleep(30);
expect(client.startTurnCalls).toHaveLength(3);
expect(bridge.stateForTest().gateway?.pendingWakes).toHaveLength(1);
await bridge.stop();
});
@ -394,6 +397,9 @@ describe("DiscordCodexBridge", () => {
expect(bridge.stateForTest().gateway?.pendingWakes?.[0]).not.toHaveProperty(
"startedAt",
);
await sleep(30);
expect(client.startTurnCalls).toHaveLength(2);
expect(bridge.stateForTest().gateway?.pendingWakes).toHaveLength(1);
await bridge.stop();
});