Expand description
The session’s request limits.
RequestLimits is shared by every worker that asks devices anything:
a global cap on how many requests a second leave across every device,
and one gate per device, so a device never has more than one of our
confirmed requests outstanding, whether the browser, the watch list, a
write or a managed COV renewal sent it (#1791). Small devices often
handle one transaction at a time.
The MCP server adds two layers (#2066): a rate per network, since a slow
MS/TP trunk behind a router takes far fewer requests than the IP side
(RequestLimits::with_network_rates), and a per-caller Account
with its own TokenBucket (charged).
Structs§
- Account
- One caller’s tally: the requests it sent and how long they waited for the limits, and the caller’s token bucket, if it has one.
- Request
Limits - Spaces requests evenly: at most
per_seconda second across every job, the browser’s and the watch list’s alike. Each caller takes the next free slot and sleeps until it; the lock is held only to take the slot, never across the sleep. It also remembers when recent requests went, for the request-rate meter. - Token
Bucket - A token bucket: at most
burstrequests at once, refilled atper_second. A caller that finds it empty waits for its token, which is booked as it starts waiting, so callers are served in turn and a dropped wait still spends its token. - Turn
- A request’s turn at its device: the device’s gate, held until this is dropped, on every path out of the request (an answer, an error, or the request’s future dropped).
Constants§
- METER_
WINDOW_ SECS - How long, in seconds, the request-rate meter (
RequestLimits::recent) remembers a request.