Expand description
How much one worker process may ask of each rate-limited Suotar endpoint.
One token bucket per endpoint, in memory like the circuit breaker: every endpoint is called from one process only. After its own failures, or when the breaker trips or closes again, an endpoint drops to a tenth of its rate and doubles back every five healthy minutes.
Keyed by scope like the breaker, so a testβs scoped ticks never spend what the live workers or another test may send.
StructsΒ§
- Bucket π
- Endpoint
Rate π - What an endpoint may take at full rate.
- Limiter
Snapshot π - One endpointβs limiter as it stands, for the dashboard.
ConstantsΒ§
- FLOOR_
SHARE π - The share of the full rate an endpoint drops to.
- LIMITED_
ENDPOINTS π - The endpoints
endpoint_ratelimits. - RAMP_
DOUBLING_ πINTERVAL - The reduced share doubles after each of these without a failure.
StaticsΒ§
FunctionsΒ§
- available π
- How many items, or requests, the endpoint may take right now. Unlimited endpoints answer
usize::MAX. - burst_
limit π - At least one, so an endpoint whose capacity is a couple of requests still gets one through at the floor.
- drop_
to_ πfloor - Drops
endpointstoFLOOR_SHAREof their rate, restarting the climb back. Unlimited ones are skipped. - endpoint_
rate π - The rate an endpoint is limited to, or
Nonefor one that is not limited. - overdraw π
- Spends
counteven past whatavailableallows, into debt that later refills pay off first, capped at one capacity so recovery takes at most one refill. Only for a split batchβs resent halves, which must not wait for a later iteration and re-claim the same batch. - reset π
- Forgets every bucket of
scope, so its endpoints are back at full rate with a full burst. - snapshot π
Nonefor an unlimited endpoint.- take π
- Spends
countof whatavailableallowed. - with_
bucket π