pub struct NewJob {
pub id: String,
pub queue: String,
pub job_type: String,
pub payload: Value,
pub options: JobOptions,
pub available_at: i64,
pub created_at: i64,
pub unique_key: Option<String>,
pub unique_for_ms: Option<i64>,
pub trace_parent: Option<String>,
pub membership: Membership,
}Expand description
A job ready to be stored: what QueueStore::insert
receives. Times are Unix milliseconds.
Fields§
§id: StringThe job id (a UUID v7, so ids sort in dispatch order).
queue: StringThe queue.
job_type: StringThe job type (Job::NAME).
payload: ValueThe job value as JSON.
options: JobOptionsThe options it was dispatched with.
available_at: i64When a worker may take it first.
created_at: i64When it was dispatched.
unique_key: Option<String>Set for unique jobs: a pending job with the same key (dispatched
within unique_for_ms) takes its place.
unique_for_ms: Option<i64>How long a pending unique job blocks its duplicates (None: while
it is pending).
trace_parent: Option<String>The W3C traceparent of the span that dispatched the job, so its
attempts continue that trace.
membership: MembershipThe batch and operation the job belongs to (none for a plain
dispatch). A driver stores it with the job and hands it back on
the ReservedJob.
Implementations§
Source§impl NewJob
impl NewJob
Sourcepub fn blocked_by(&self, created_at: i64) -> bool
pub fn blocked_by(&self, created_at: i64) -> bool
Whether a pending duplicate created at created_at (Unix
milliseconds) still blocks this job.
Sourcepub fn stale_after_ms(&self) -> i64
pub fn stale_after_ms(&self) -> i64
How long after a worker reserved it the job counts as abandoned, in
milliseconds: its timeout_secs (one day when 0) plus
STALE_RESERVATION_GRACE_SECS.
A store hands an abandoned reservation to the next worker.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for NewJob
impl<'de> Deserialize<'de> for NewJob
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for NewJob
Auto Trait Implementations§
impl Forget for NewJob
impl Freeze for NewJob
impl RefUnwindSafe for NewJob
impl Send for NewJob
impl Sync for NewJob
impl Unpin for NewJob
impl UnsafeUnpin for NewJob
impl UnwindSafe for NewJob
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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 more