mirror of
https://github.com/chatmail/core.git
synced 2026-04-17 21:46:35 +03:00
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:
14
src/job.rs
14
src/job.rs
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user