pub struct Job {
pub id: String,
pub queue: String,
pub name: String,
pub data: Value,
pub status: JobStatus,
pub options: JobOptions,
pub created_at: DateTime<Utc>,
pub started_at: Option<DateTime<Utc>>,
pub finished_at: Option<DateTime<Utc>>,
pub attempts: u32,
pub error: Option<String>,
pub result: Option<Value>,
}Expand description
任务信息
Fields§
§id: String任务 ID
queue: String队列名称
name: String任务名称
data: Value任务数据
status: JobStatus任务状态
options: JobOptions任务选项
created_at: DateTime<Utc>创建时间
started_at: Option<DateTime<Utc>>开始处理时间
finished_at: Option<DateTime<Utc>>完成时间
attempts: u32已尝试次数
error: Option<String>错误信息
result: Option<Value>返回值
Implementations§
Source§impl Job
impl Job
Sourcepub fn mark_active(&mut self)
pub fn mark_active(&mut self)
标记为运行中
Sourcepub fn mark_completed(&mut self, result: Option<Value>)
pub fn mark_completed(&mut self, result: Option<Value>)
标记为完成
Sourcepub fn mark_failed(&mut self, error: &str)
pub fn mark_failed(&mut self, error: &str)
标记为失败
Sourcepub fn duration_ms(&self) -> Option<i64>
pub fn duration_ms(&self) -> Option<i64>
获取执行耗时(毫秒)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Job
impl<'de> Deserialize<'de> for Job
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Job
impl RefUnwindSafe for Job
impl Send for Job
impl Sync for Job
impl Unpin for Job
impl UnwindSafe for Job
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)