Skip to main content

Module limits

Module limits 

Source
Expand description

Time limit for one request.

Handlers run on blocking threads, and a blocking thread cannot be stopped from outside: a request that runs away would hold its slot (one of MAX_INFLIGHT) for as long as it likes. So a request stops itself. The server sets a deadline for the thread before calling the handler, and the loops whose length the client controls (owner directory pages, cold index partitions, the transactions of a page or a ledger) call check. Past the deadline the request ends with tooBusy and its slot goes to the next one. Threads that read for a request (cold::Cold::ledgers) take its deadline with them (current, start_at).

Structs§

Deadline
The deadline of the current thread’s request; cleared when dropped, so a pooled thread does not carry it into the next task.

Constants§

EXCEEDED
The error text that carries an exceeded limit through modules whose errors are strings; api::internal turns it back into tooBusy.

Functions§

check
Err(EXCEEDED) once the current request is past its deadline. Without a deadline (loading, tools, tests) there is no limit.
current
The deadline of the current thread’s request, to hand to threads that read for it.
old_state_allowed
Whether the current request may read state before the snapshot. Requests outside the server (tools, tests) may.
start
Starts the limit for the request about to run on this thread.
start_at
Runs this thread under a deadline taken from another (current); None sets none.
start_public
start for a request from a public listener. Such a request also does not read state before the snapshot: a read there decompresses cold blocks, and the public budgets don’t count that work yet.