mirror of
https://github.com/chatmail/core.git
synced 2026-05-23 00:36:32 +03:00
fix: retry sending MDNs on temporary error
Postfix returns 421 4.4.2 Error: timeout exceeded when overloaded by CI. If MDN is not retried in this case, `test_qr_readreceipt` fails.
This commit is contained in:
36
src/smtp.rs
36
src/smtp.rs
@@ -830,20 +830,26 @@ async fn send_mdn(context: &Context, smtp: &mut Smtp) -> Result<bool> {
|
|||||||
.await
|
.await
|
||||||
.context("failed to update MDN retries count")?;
|
.context("failed to update MDN retries count")?;
|
||||||
|
|
||||||
let res = send_mdn_msg_id(context, msg_id, contact_id, smtp).await;
|
match send_mdn_msg_id(context, msg_id, contact_id, smtp).await {
|
||||||
if let Err(ref err) = res {
|
Err(err) => {
|
||||||
// If there is an error, for example there is no message corresponding to the msg_id in the
|
// If there is an error, for example there is no message corresponding to the msg_id in the
|
||||||
// database, do not try to send this MDN again.
|
// database, do not try to send this MDN again.
|
||||||
warn!(
|
warn!(
|
||||||
context,
|
context,
|
||||||
"Error sending MDN for {msg_id}, removing it: {err:#}."
|
"Error sending MDN for {msg_id}, removing it: {err:#}."
|
||||||
);
|
);
|
||||||
context
|
context
|
||||||
.sql
|
.sql
|
||||||
.execute("DELETE FROM smtp_mdns WHERE msg_id = ?", (msg_id,))
|
.execute("DELETE FROM smtp_mdns WHERE msg_id = ?", (msg_id,))
|
||||||
.await?;
|
.await?;
|
||||||
|
Err(err)
|
||||||
|
}
|
||||||
|
Ok(false) => {
|
||||||
|
bail!("Temporary error while sending an MDN");
|
||||||
|
}
|
||||||
|
Ok(true) => {
|
||||||
|
// Successfully sent MDN.
|
||||||
|
Ok(true)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// If there's a temporary error, pretend there are no more MDNs to send. It's unlikely that
|
|
||||||
// other MDNs could be sent successfully in case of connectivity problems.
|
|
||||||
res
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user