Module ratelim

Source
Expand description

Implement half of log rate-limiting: the ability to cause the state of a Loggable to get flushed at appropriate intervals.

Modules§

rt 🔒
Declare a dyn-safe trait for the parts of an asynchronous runtime so that we can install it globally.

Structs§

Inner 🔒
The mutable state of a RateLim.
RateLim
A rate-limited wrapper around a [Loggable]` that ensures its events are flushed from time to time.

Constants§

RESET_AFTER_DORMANT_FOR 🔒
After approximately this many seconds of not having anything to report, we should reset our timeout schedule.

Functions§

run 🔒
Helper: runs in a background task, and periodically flushes the Loggable in ratelim. Exits after [Loggable::flush] returns [Activity::Dormant] for “long enough”.
timeout_sequence 🔒
Return an iterator of reasonable amounts of time to summarize.