Struct TaskOptions

Source
pub struct TaskOptions {
    pub time_limit: Option<u32>,
    pub hard_time_limit: Option<u32>,
    pub max_retries: Option<u32>,
    pub min_retry_delay: Option<u32>,
    pub max_retry_delay: Option<u32>,
    pub retry_for_unexpected: Option<bool>,
    pub acks_late: Option<bool>,
    pub content_type: Option<MessageContentType>,
}
Expand description

Configuration options pertaining to a task.

These are set at either the app level (pertaining to all registered tasks), the task level (pertaining to a specific task), or - in some cases - at the request / signature level (pertaining only to an individual task request).

The order of precedence is determined by how specific the given configuration option is. That is, options set at the request level have the highest precedence, followed by options set at the task level, and lastly the app level.

For example, if time_limit: Some(10) is set at the app level through the task_time_limit option, then every task will use a time limit of 10 seconds unless some other time limit is specified in the task definition or in a task signature for that task.

Fields§

§time_limit: Option<u32>

Time limit for a task.

If set to Some(n), the task will be interrupted and fail with a TimeoutError if it runs longer than n seconds.

This can be set with

If this option is left unspecified, the default behavior will be to enforce no time limit.

Note, however, that only non-blocking tasks can be interrupted, so it’s important to use async functions within task implementations whenever they are available.

§hard_time_limit: Option<u32>

The time_limit option is equivalent to the “soft time limit” option when sending tasks to a Python consumer. If you desire to set a “hard time limit”, use this option.

Note that this is really only for compatability with Python workers. time_limit and hard_time_limit are treated the same by Rust workers, and if both are set, the minimum of the two will be used.

This can be set with

§max_retries: Option<u32>

Maximum number of retries for this task.

This can be set with

If this option is left unspecified, the default behavior will be to retry tasks indefinitely.

§min_retry_delay: Option<u32>

Minimum retry delay (in seconds).

This can be set with

If this option is left unspecified, the default behavior will be to use 0 as the minimum. In practice this means the first retry will usually be delayed only a couple hundred milliseconds. The delay for subsequent retries will increase exponentially (with random jitter) before maxing out at max_retry_delay.

§max_retry_delay: Option<u32>

Maximum retry delay (in seconds).

This can be set with

If this option is left unspecified, the default behavior will be to cap delays at 1 hour (3600 seconds) with some random jitter.

§retry_for_unexpected: Option<bool>

Whether or not to retry the task when an UnexpectedError is returned.

This can be set with

If this option is left unspecified, the default behavior will be to retry for these errors.

§acks_late: Option<bool>

Whether messages will be acknowledged after the task has been executed or before.

If your tasks are idempotent then it is recommended that you set this to true.

This can be set with

If this option is left unspecified, the default behavior will be to ack early.

§content_type: Option<MessageContentType>

Which serialization format to use for task messages.

This can be set with

Trait Implementations§

Source§

impl Clone for TaskOptions

Source§

fn clone(&self) -> TaskOptions

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Default for TaskOptions

Source§

fn default() -> TaskOptions

Returns the “default value” for a type. Read more
Source§

impl Copy for TaskOptions

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T