Postpone DeleteMsgOnImap on error

If job returns Status::Finished, it will be deleted. Then
add_imap_deletion_jobs will recreate it immediately if the message is
expired. To actually backoff the job, we should postpone it instead of
removing.
This commit is contained in:
Alexander Krotov
2020-03-07 20:33:56 +03:00
parent 055aba189c
commit c4677190be

View File

@@ -469,12 +469,16 @@ impl Job {
imap_inbox.delete_msg(context, &mid, server_folder, msg.server_uid)
};
match res {
ImapActionResult::RetryLater => {
return Status::RetryLater;
}
ImapActionResult::AlreadyDone | ImapActionResult::Success => {}
ImapActionResult::Failed => {
return Status::Finished(Err(format_err!("Message deletion failed")));
ImapActionResult::RetryLater | ImapActionResult::Failed => {
// If job has failed, for example due to some
// IMAP bug, we postpone it instead of failing
// immediately. This will prevent adding it
// immediately again if user has enabled
// automatic message deletion. Without this,
// we might waste a lot of traffic constantly
// retrying message deletion.
return Status::RetryLater;
}
}
}