pub struct RateLimitedWorkerPool<Q: Queue + 'static> { /* private fields */ }Expand description
A WorkerPool whose dequeue is rate-limited via a token bucket.
Implementations§
Source§impl<Q: Queue + 'static> RateLimitedWorkerPool<Q>
impl<Q: Queue + 'static> RateLimitedWorkerPool<Q>
Sourcepub fn new(
queue: Q,
worker_cfg: WorkerConfig,
rate_per_sec: f64,
burst: u32,
) -> Self
pub fn new( queue: Q, worker_cfg: WorkerConfig, rate_per_sec: f64, burst: u32, ) -> Self
Creates a rate-limited worker pool wrapping queue with the given
token-bucket rate (tokens/sec) and burst capacity.
Sourcepub fn start<H>(&self, topic: &str, handler: H)where
H: JobHandler + 'static,
pub fn start<H>(&self, topic: &str, handler: H)where
H: JobHandler + 'static,
Starts workers consuming from topic with the given handler.
Auto Trait Implementations§
impl<Q> !RefUnwindSafe for RateLimitedWorkerPool<Q>
impl<Q> !UnwindSafe for RateLimitedWorkerPool<Q>
impl<Q> Freeze for RateLimitedWorkerPool<Q>
impl<Q> Send for RateLimitedWorkerPool<Q>
impl<Q> Sync for RateLimitedWorkerPool<Q>
impl<Q> Unpin for RateLimitedWorkerPool<Q>
impl<Q> UnsafeUnpin for RateLimitedWorkerPool<Q>
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