pub struct JobQueue { /* private fields */ }jobs only.Expand description
An in-memory background job queue backed by a fixed-size worker pool.
Jobs that return Err are retried with exponential backoff (default: 3
retries, 500 ms initial backoff, 2x multiplier) — the same worker thread
that picked up the job sleeps between attempts, so a job that retries
repeatedly occupies one worker for the duration of its backoff; size the
pool with that in mind. Queued and retrying jobs are lost if the process
exits; see PersistentJobQueue for crash-safe persistence.
Implementations§
Source§impl JobQueue
impl JobQueue
Sourcepub fn new(workers: usize) -> Self
pub fn new(workers: usize) -> Self
Create a queue backed by workers worker threads.
Default retry policy: 3 retries, 500 ms initial backoff, 2x multiplier.
Adjust it with max_retries / backoff
before submitting jobs.
Sourcepub fn max_retries(self, n: u32) -> Self
pub fn max_retries(self, n: u32) -> Self
Override the number of retries after the initial attempt (default: 3).
Sourcepub fn backoff(self, initial: Duration, multiplier: u32) -> Self
pub fn backoff(self, initial: Duration, multiplier: u32) -> Self
Override the backoff policy: initial delay before the first retry,
doubled (or scaled by multiplier) on each subsequent attempt.
Auto Trait Implementations§
impl !RefUnwindSafe for JobQueue
impl !UnwindSafe for JobQueue
impl Freeze for JobQueue
impl Send for JobQueue
impl Sync for JobQueue
impl Unpin for JobQueue
impl UnsafeUnpin for JobQueue
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
map-response-body only.Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
trace only.Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
trace only.