pub struct Hold { /* private fields */ }Expand description
A deadline before which no request on a throttle may proceed.
A throttle’s buckets model the quota a venue publishes; a hold is what
the server actually just said. They disagree more often than the tables
suggest — Cloudflare’s error code: 1015 is an IP-scoped block with its
own window, and it answers 429 no matter how many tokens the buckets still
hold. So a 429 holds every request sharing the throttle, not just the one
that saw it.
A hold only ever extends: several concurrent requests typically see the
same 429 within a few milliseconds of each other, and taking the most
recent value would let whichever response carried the smallest delay
release all of them early. wait re-reads the deadline
after waking, so a hold extended mid-wait is honoured in full.
A clone shares the deadline. Every layer of one throttle holds a clone of
one Hold, so replacing or resizing a layer keeps it.
Implementations§
Source§impl Hold
impl Hold
Sourcepub fn with_ceiling(ceiling: Duration) -> Self
pub fn with_ceiling(ceiling: Duration) -> Self
A hold that clamps every extend to ceiling, so a
server asking for longer holds for ceiling.