Skip to main content

prune_sample

Function prune_sample 

Source
fn prune_sample(
    buckets: &mut BTreeMap<String, (Instant, f64)>,
    cursor: &mut String,
    rate: f64,
    burst: f64,
    now: Instant,
)
Expand description

Remove, from the next bounded sample of the table, the buckets that have refilled completely.

Each sample starts after the last account the previous one inspected and wraps around at the end, so successive samples reach every bucket even while the leading ones stay restricted. A bucket that is still restricted is never removed.