Expand description
Implement half of log rate-limiting: the ability to cause the state of a Loggable to get flushed at appropriate intervals.
Re-exportsΒ§
use std::sync::Arc;πuse std::sync::Mutex;πuse std::time::Duration;πuse tor_error::ErrorReport;πuse tor_rtcompat::SpawnExt as _;π
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
Loggableinratelim. Exits after [Loggable::flush] returns [Activity::Dormant] for βlong enoughβ. - timeout_
sequence π - Return an iterator of reasonable amounts of time to summarize.