test(db): add abort-racing-send + rejectAllWaiters coverage; document notifyOneWaiter invariant

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Mika Kuns
2026-05-20 16:15:39 +02:00
parent 31584fe623
commit b74e969229
2 changed files with 46 additions and 0 deletions

View File

@@ -274,6 +274,7 @@ export class MailboxStore {
});
}
// Invariant: synchronous from consumeOne to resolve. Introducing an `await` between them risks marking a message delivered with no listener to receive it.
private notifyOneWaiter(name: string): void {
const bucket = this.waiters.get(name);
if (!bucket || bucket.size === 0) return;