mirror of
https://github.com/chatmail/core.git
synced 2026-05-07 08:56:30 +03:00
refactor(job): implement Display for Job
This commit is contained in:
15
src/job.rs
15
src/job.rs
@@ -4,6 +4,7 @@
|
|||||||
//! and job types.
|
//! and job types.
|
||||||
|
|
||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
use std::*;
|
||||||
|
|
||||||
use deltachat_derive::{FromSql, ToSql};
|
use deltachat_derive::{FromSql, ToSql};
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
@@ -123,6 +124,12 @@ pub struct Job {
|
|||||||
pub pending_error: Option<String>,
|
pub pending_error: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Job {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||||
|
write!(f, "#{}, action {}", self.job_id, self.action)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Job {
|
impl Job {
|
||||||
/// Deletes the job from the database.
|
/// Deletes the job from the database.
|
||||||
fn delete(&self, context: &Context) -> bool {
|
fn delete(&self, context: &Context) -> bool {
|
||||||
@@ -733,13 +740,7 @@ fn job_perform(context: &Context, thread: Thread, probe_network: bool) {
|
|||||||
let jobs: Vec<Job> = load_jobs(context, thread, probe_network);
|
let jobs: Vec<Job> = load_jobs(context, thread, probe_network);
|
||||||
|
|
||||||
for mut job in jobs {
|
for mut job in jobs {
|
||||||
info!(
|
info!(context, "{}-job {} started...", thread, job);
|
||||||
context,
|
|
||||||
"{}-job #{}, action {} started...",
|
|
||||||
thread,
|
|
||||||
job.job_id,
|
|
||||||
job.action,
|
|
||||||
);
|
|
||||||
|
|
||||||
// some configuration jobs are "exclusive":
|
// some configuration jobs are "exclusive":
|
||||||
// - they are always executed in the imap-thread and the smtp-thread is suspended during execution
|
// - they are always executed in the imap-thread and the smtp-thread is suspended during execution
|
||||||
|
|||||||
Reference in New Issue
Block a user