je_load_density.utils.throttle.rps_throttle
Per-key RPS throttle.
Token-bucket limiter that caps the request rate for a named bucket. Buckets are shared by name so multiple tasks (or workers in the same process) can coordinate on the same cap.
Functions
|
Return the shared throttle for |
Classes
|
Token-bucket throttle. |
- class je_load_density.utils.throttle.rps_throttle.RpsThrottle(rps: float, burst: int | None = None)
Bases:
objectToken-bucket throttle.
acquireblocks until one token is available, then consumes it.- acquire() None
- je_load_density.utils.throttle.rps_throttle.get_throttle(key: str, rps: float, burst: int | None = None) RpsThrottle
Return the shared throttle for
key; create it on first call. Subsequent calls ignore laterrps/burstarguments — clear withreset_throttles()to reconfigure.
- je_load_density.utils.throttle.rps_throttle.reset_throttles() None