Skip to content

Commit 20b46d5

Browse files
committed
Clean up in-flight depth listener
Make the in-flight depth test release its blocked listener even when the assertion fails, so the test cannot leave a pending listen promise behind. #748 (comment) Assisted-by: Codex:gpt-5.5
1 parent 07173a5 commit 20b46d5

1 file changed

Lines changed: 13 additions & 9 deletions

File tree

packages/fedify/src/federation/mq.test.ts

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,19 @@ test("InProcessMessageQueue.getDepth() excludes in-flight messages", async () =>
204204
controller.abort();
205205
}, { signal: controller.signal });
206206

207-
await mq.enqueue("in-flight");
208-
await handlerStarted;
209-
assertEquals(await mq.getDepth(), {
210-
queued: 0,
211-
ready: 0,
212-
delayed: 0,
213-
});
214-
resolveHandler?.();
215-
await listening;
207+
try {
208+
await mq.enqueue("in-flight");
209+
await handlerStarted;
210+
assertEquals(await mq.getDepth(), {
211+
queued: 0,
212+
ready: 0,
213+
delayed: 0,
214+
});
215+
} finally {
216+
resolveHandler?.();
217+
controller.abort();
218+
await listening;
219+
}
216220
});
217221

218222
test("InProcessMessageQueue orderingKey", async (t) => {

0 commit comments

Comments
 (0)