mirror of
https://github.com/chatmail/core.git
synced 2026-04-18 22:16:30 +03:00
fix ordering error
This commit is contained in:
16
src/job.rs
16
src/job.rs
@@ -193,14 +193,24 @@ impl Job {
|
||||
Err(crate::smtp::send::Error::SendError(err)) => {
|
||||
// Remote error, retry later.
|
||||
warn!(context, "SMTP failed to send: {}", err);
|
||||
smtp.disconnect();
|
||||
self.pending_error = Some(err.to_string());
|
||||
|
||||
// if the connection was successfully used more than 60
|
||||
// seconds ago, try an immediate reconnect.
|
||||
let mut res = Status::RetryLater;
|
||||
if let Some(secs) = smtp.secs_since_last_success() {
|
||||
if secs > 60 {
|
||||
return Status::RetryNow;
|
||||
info!(
|
||||
context,
|
||||
"SMTP connection was stale, triggering immediate reconnect"
|
||||
);
|
||||
res = Status::RetryNow;
|
||||
}
|
||||
}
|
||||
Status::RetryLater
|
||||
// this clears last_success info
|
||||
smtp.disconnect();
|
||||
|
||||
res
|
||||
}
|
||||
Err(crate::smtp::send::Error::EnvelopeError(err)) => {
|
||||
// Local error, job is invalid, do not retry.
|
||||
|
||||
Reference in New Issue
Block a user