Skip to main content

Module ratelim

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.

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 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.