Skip to content

blackbull.server.deadline

blackbull.server.deadline

Loop-scoped shared deadline scanner.

Enforcement can lag by one BB_DEADLINE_TICK_MS interval. The registry must quiesce when empty and resume on the next arm; each worker owns its scanner.

Deadline

Bases: _Armed

A deadline the shared scanner enforces: on_expiry runs once it passes, on the loop, synchronously, at most one tick late.

Guard

Bases: _Armed

Bound the body of with guard.within(seconds): and raise TimeoutError.

Expiry cancels the task that created the guard; a read that completes in the tick the deadline fires is still a timeout, as with asyncio.timeout.

SharedGuard

Bases: _Armed

A Guard several tasks may enter at once, as concurrent drains do.

The first to enter owns the deadline and is the one cancelled; a task that enters while another owns it rides along without rearming it.