Struct background_jobs_core::JobInfo
source · pub struct JobInfo {
pub id: Uuid,
pub name: String,
pub queue: String,
pub args: Value,
pub retry_count: u32,
pub max_retries: MaxRetries,
pub backoff_strategy: Backoff,
pub next_queue: OffsetDateTime,
pub heartbeat_interval: u64,
}
Expand description
Metadata pertaining to a job that exists within the background_jobs system
Although exposed publically, this type should only really be handled by the library itself, and is impossible to create outside of the new_job method.
Fields§
§id: Uuid
ID of the job
name: String
Name of the job
queue: String
Name of the queue that this job is a part of
args: Value
Arguments for a given job
retry_count: u32
Retries left for this job, None means no limit
max_retries: MaxRetries
the initial MaxRetries value, for comparing to the current retry count
backoff_strategy: Backoff
How often retries should be scheduled
next_queue: OffsetDateTime
The time this job should be dequeued
heartbeat_interval: u64
Milliseconds from execution until the job is considered dead
This is important for storage implementations to reap unfinished jobs
Implementations§
source§impl JobInfo
impl JobInfo
sourcepub fn unexecuted(self) -> ReturnJobInfo
pub fn unexecuted(self) -> ReturnJobInfo
Convert a JobInfo into a ReturnJobInfo without executing it
sourcepub fn next_queue_id(&self) -> Uuid
pub fn next_queue_id(&self) -> Uuid
Produce a UUID from the next_queue timestamp
sourcepub fn prepare_retry(&mut self) -> bool
pub fn prepare_retry(&mut self) -> bool
Increment the retry-count and set next_queue based on the job’s configuration
returns true
if the job should be retried