Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/leasing/wait-queue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ export class WaitQueue {
}

/**
* Arms (or re-arms, after a cycle back through `queued`) this waiter's timeout. `deadlineAt` is
* why: Arms (or re-arms, after a cycle back through `queued`) this waiter's timeout. `deadlineAt` is
* computed once, the first time a waiter with a `timeoutMs` is ever armed, and never moved
* afterward -- every later call here (a re-enqueue `enqueue` already let through because the
* deadline had not yet passed) times the remaining budget against that same fixed deadline
Expand Down Expand Up @@ -362,11 +362,13 @@ export class WaitQueue {
* would have fired at the identical moment anyway), but real, not merely theoretical --
* `FakeClock` (every test here) never fires early, so no test under it can ever land in this
* window, which is why the difference is a doc claim to get right rather than a behavior to
* cover with one. Separately: `markNew` (below) is a public path back to `queued` that arms no
* timer at all -- a waiter it returns to `queued` sits with no deadline until some *other*
* `enqueue` call re-arms it, which is a real gap in `timeoutMs` enforcement for whichever
* caller uses that path (`LeaseAcquisitionCoordinator`'s own eviction and provision-retry
* callers, not this module's problem to close on its own).
* cover with one.
*
* `markNew` arms nothing, and that is safe only because its callers hand the waiter straight
* back to a decision: every branch of that decision that keeps the waiter alive passes
* `#expireIfPastDeadline` (through `markProcessing`) or `enqueue`'s own upfront check first. A
* caller that returned without re-deciding would leave a waiter `queued` with a fixed deadline
* and no timer, and would have to arm here.
*/
#armTimeout(waiter: MutableWaiter): void {
if (waiter.timer !== undefined || waiter.options.timeoutMs === undefined) return;
Expand Down
Loading