From 7e66af05ff83693aa57aae6277d3210efb1330bb Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Thu, 28 Nov 2019 21:44:44 +0100 Subject: [PATCH] Calculate job backoff relative to the current time Otherwise it is possible that desired_timestamp is in the past. --- src/job.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/job.rs b/src/job.rs index bc7e63a24..260a5a6da 100644 --- a/src/job.rs +++ b/src/job.rs @@ -810,11 +810,11 @@ fn job_perform(context: &Context, thread: Thread, probe_network: bool) { if tries < JOB_RETRIES { job.tries = tries; let time_offset = get_backoff_time_offset(tries); - job.desired_timestamp = job.added_timestamp + time_offset; + job.desired_timestamp = time() + time_offset; job.update(context); info!( context, - "{}-job #{} not succeeded on try #{}, retry in ADD_TIME+{} (in {} seconds).", + "{}-job #{} not succeeded on try #{}, retry in {} seconds.", if thread == Thread::Imap { "INBOX" } else { @@ -822,8 +822,7 @@ fn job_perform(context: &Context, thread: Thread, probe_network: bool) { }, job.job_id as u32, tries, - time_offset, - job.added_timestamp + time_offset - time() + time_offset ); if thread == Thread::Smtp && tries < JOB_RETRIES - 1 { context