pub struct RunningJobData {
pub id: Uuid,
pub name: Option<String>,
pub worker_id: u64,
pub heartbeat_increment: i32,
pub job_type: String,
pub priority: i32,
pub weight: u16,
pub payload: Vec<u8>,
pub expires: AtomicI64,
pub start_time: OffsetDateTime,
pub current_try: i32,
pub max_retries: i32,
/* private fields */
}
Expand description
Information about a running job. This is usually accessed through the RunningJob type, which wraps this in an Arc.
Fields§
§id: Uuid
The id of this job.
name: Option<String>
The name given to this job
worker_id: u64
The ID of the Worker that is running this job.
heartbeat_increment: i32
How many seconds a heartbeat can extend the expiration time.
job_type: String
The type of the job.
priority: i32
The job’s priority.
weight: u16
How much this job counts against the worker’s concurrency limit.
payload: Vec<u8>
The payload of the job. JSON payloads can be parsed using the RunningJobData::json_payload function.
expires: AtomicI64
The timestamp, in seconds, when this job expires.
start_time: OffsetDateTime
When the job was started.
current_try: i32
How many times this job has been tried already. On the first run, this will be 0.
max_retries: i32
The number of times this job can be retried before giving up permanently.
Implementations§
Source§impl RunningJobData
impl RunningJobData
Sourcepub async fn checkpoint_blob(
&self,
new_payload: Vec<u8>,
) -> Result<OffsetDateTime>
pub async fn checkpoint_blob( &self, new_payload: Vec<u8>, ) -> Result<OffsetDateTime>
Checkpoint the task, replacing the payload with the passed in value.
Sourcepub async fn checkpoint_json<T: Serialize>(
&self,
new_payload: T,
) -> Result<OffsetDateTime>
pub async fn checkpoint_json<T: Serialize>( &self, new_payload: T, ) -> Result<OffsetDateTime>
Checkpoint the task, replacing the payload with the passed in value.
Sourcepub async fn heartbeat(&self) -> Result<OffsetDateTime>
pub async fn heartbeat(&self) -> Result<OffsetDateTime>
Tell the queue that the task is still running.
Sourcepub fn is_expired(&self) -> bool
pub fn is_expired(&self) -> bool
Return if the task is past the expiration time or not.
Sourcepub fn json_payload<'a, T: Deserialize<'a>>(&'a self) -> Result<T>
pub fn json_payload<'a, T: Deserialize<'a>>(&'a self) -> Result<T>
Deserialize a JSON payload into the requested type.