pub struct SharedRateLimiter { /* private fields */ }Expand description
Thread-safe rate limiter for parallel API requests
Implementations§
Sourcepub fn new(max_concurrent: usize) -> Self
pub fn new(max_concurrent: usize) -> Self
Create a new shared rate limiter with given concurrency
Sourcepub async fn acquire(&self) -> RateLimitGuard
pub async fn acquire(&self) -> RateLimitGuard
Acquire a permit and wait for rate limit, returns a guard
Sourcepub fn on_success(&self)
pub fn on_success(&self)
Handle a successful request - reset backoff
Sourcepub fn on_rate_limit(&self)
pub fn on_rate_limit(&self)
Handle a rate limit (429) response - increase backoff
Sourcepub fn should_pause(&self) -> bool
pub fn should_pause(&self) -> bool
Check if we should pause sync due to repeated rate limits
Sourcepub fn current_backoff(&self) -> Duration
pub fn current_backoff(&self) -> Duration
Get the current backoff duration
Sourcepub fn pause_duration(&self) -> Duration
pub fn pause_duration(&self) -> Duration
Get pause duration (30 minutes after 5 consecutive 429s)
Trait Implementations§
Source§fn clone(&self) -> SharedRateLimiter
fn clone(&self) -> SharedRateLimiter
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more