pub struct PooledWorkerBuilder<B> { /* private fields */ }Expand description
Builder for PooledWorker with sensible defaults.
By default, derives the worker ID from {hostname}-{pid}.
Override with worker_id.
Created via PooledWorker::builder.
Implementations§
Source§impl<B> PooledWorkerBuilder<B>where
B: PersistentBackend + TaskClaimStore + 'static,
impl<B> PooledWorkerBuilder<B>where
B: PersistentBackend + TaskClaimStore + 'static,
Sourcepub fn worker_id(self, id: impl Into<String>) -> Self
pub fn worker_id(self, id: impl Into<String>) -> Self
Set an explicit worker ID.
If not called, the ID is auto-generated from {hostname}-{pid}.
Sourcepub fn claim_ttl(self, ttl: Option<Duration>) -> Self
pub fn claim_ttl(self, ttl: Option<Duration>) -> Self
Set the TTL for task claims (default: 5 minutes).
Sourcepub fn batch_size(self, size: NonZeroUsize) -> Self
pub fn batch_size(self, size: NonZeroUsize) -> Self
Set the number of tasks to fetch per poll (default: 1).
Sourcepub fn aging_interval(self, interval: Duration) -> Self
pub fn aging_interval(self, interval: Duration) -> Self
Set the aging interval for priority-based scheduling (default: 300s).
§Panics
Panics if interval is zero.
Set affinity tags for this worker.
When tags are set, the worker only picks up tasks whose tags are a subset of the worker’s tags (or tasks with no tags). When no tags are set (the default), the worker accepts all tasks.
Sourcepub fn build(self) -> PooledWorker<B>
pub fn build(self) -> PooledWorker<B>
Build the PooledWorker.
If no worker_id was set, generates one from {hostname}-{pid}.
Auto Trait Implementations§
impl<B> Freeze for PooledWorkerBuilder<B>where
B: Freeze,
impl<B> !RefUnwindSafe for PooledWorkerBuilder<B>
impl<B> Send for PooledWorkerBuilder<B>where
B: Send,
impl<B> Sync for PooledWorkerBuilder<B>where
B: Sync,
impl<B> Unpin for PooledWorkerBuilder<B>where
B: Unpin,
impl<B> UnsafeUnpin for PooledWorkerBuilder<B>where
B: UnsafeUnpin,
impl<B> !UnwindSafe for PooledWorkerBuilder<B>
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
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> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::RequestSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.