mirror of
https://github.com/chatmail/core.git
synced 2026-05-01 20:36:31 +03:00
fix(send_msg_to_smtp): do not fail if the message does not exist anymore
If the number of retries for message is exceeded, do not fail when marking it as failed if the message does not exist. Otherwise we may never delete the message from SMTP queue because corresponding msg_id is not valid anymore.
This commit is contained in:
@@ -372,8 +372,10 @@ pub(crate) async fn send_msg_to_smtp(
|
||||
)
|
||||
.await?;
|
||||
if retries > 6 {
|
||||
let mut msg = Message::load_from_db(context, msg_id).await?;
|
||||
message::set_msg_failed(context, &mut msg, "Number of retries exceeded the limit.").await?;
|
||||
if let Some(mut msg) = Message::load_from_db_optional(context, msg_id).await? {
|
||||
message::set_msg_failed(context, &mut msg, "Number of retries exceeded the limit.")
|
||||
.await?;
|
||||
}
|
||||
context
|
||||
.sql
|
||||
.execute("DELETE FROM smtp WHERE id=?", (rowid,))
|
||||
|
||||
Reference in New Issue
Block a user