pub struct WorkerOptions {
pub queues: Vec<String>,
pub sleep: Duration,
pub max_jobs: Option<u64>,
pub stop_when_empty: bool,
pub timeout: Option<Duration>,
}Expand description
How a worker behaves.
Fields§
§queues: Vec<String>The queues to serve, in priority order — earlier ones are drained
first, which is how a high queue gets ahead of default.
sleep: DurationHow long to wait before looking again when every queue is empty.
max_jobs: Option<u64>Stop after this many jobs. None runs forever.
stop_when_empty: boolStop as soon as the queues are empty, rather than waiting for more.
timeout: Option<Duration>Give up on a job that runs longer than this.
Implementations§
Source§impl WorkerOptions
impl WorkerOptions
Sourcepub fn queues(self, queues: impl IntoIterator<Item = impl Into<String>>) -> Self
pub fn queues(self, queues: impl IntoIterator<Item = impl Into<String>>) -> Self
Serve these queues, in priority order.
Sourcepub fn max_jobs(self, max: u64) -> Self
pub fn max_jobs(self, max: u64) -> Self
Stop after max jobs — for a worker that should recycle periodically.
Sourcepub fn stop_when_empty(self) -> Self
pub fn stop_when_empty(self) -> Self
Return as soon as there is nothing left to do.
Trait Implementations§
Source§impl Clone for WorkerOptions
impl Clone for WorkerOptions
Source§impl Debug for WorkerOptions
impl Debug for WorkerOptions
Auto Trait Implementations§
impl Freeze for WorkerOptions
impl RefUnwindSafe for WorkerOptions
impl Send for WorkerOptions
impl Sync for WorkerOptions
impl Unpin for WorkerOptions
impl UnsafeUnpin for WorkerOptions
impl UnwindSafe for WorkerOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Event for T
impl<T> Event for T
Source§fn event_name() -> &'static strwhere
Self: Sized,
fn event_name() -> &'static strwhere
Self: Sized,
A human-readable name, used by wildcard listeners and log output.
Always the Rust type path; see the trait docs.