Calculate job backoff relative to the current time

Otherwise it is possible that desired_timestamp is in the past.
This commit is contained in:
Alexander Krotov
2019-11-28 21:44:44 +01:00
committed by Floris Bruynooghe
parent f0486eb820
commit 7e66af05ff

View File

@@ -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