mirror of
https://github.com/chatmail/core.git
synced 2026-05-02 21:06:31 +03:00
fix: delete available_post_msgs row if the message is already downloaded
The row does not need to stay in the database only to be skipped each time.
This commit is contained in:
@@ -326,22 +326,25 @@ pub(crate) async fn download_known_post_messages_without_pre_message(
|
|||||||
})
|
})
|
||||||
.await?;
|
.await?;
|
||||||
for rfc724_mid in &rfc724_mids {
|
for rfc724_mid in &rfc724_mids {
|
||||||
if !msg_is_downloaded_for(context, rfc724_mid).await? {
|
if msg_is_downloaded_for(context, rfc724_mid).await? {
|
||||||
// Download the Post-Message unconditionally,
|
delete_from_available_post_msgs(context, rfc724_mid).await?;
|
||||||
// because the Pre-Message got lost.
|
continue;
|
||||||
// The message may be in the wrong order,
|
}
|
||||||
// but at least we have it at all.
|
|
||||||
let res = download_msg(context, rfc724_mid.clone(), session).await;
|
// Download the Post-Message unconditionally,
|
||||||
if let Ok(Some(())) = res {
|
// because the Pre-Message got lost.
|
||||||
delete_from_available_post_msgs(context, rfc724_mid).await?;
|
// The message may be in the wrong order,
|
||||||
}
|
// but at least we have it at all.
|
||||||
if let Err(err) = res {
|
let res = download_msg(context, rfc724_mid.clone(), session).await;
|
||||||
warn!(
|
if let Ok(Some(())) = res {
|
||||||
context,
|
delete_from_available_post_msgs(context, rfc724_mid).await?;
|
||||||
"download_known_post_messages_without_pre_message: Failed to download message rfc724_mid={rfc724_mid}: {:#}.",
|
}
|
||||||
err
|
if let Err(err) = res {
|
||||||
);
|
warn!(
|
||||||
}
|
context,
|
||||||
|
"download_known_post_messages_without_pre_message: Failed to download message rfc724_mid={rfc724_mid}: {:#}.",
|
||||||
|
err
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user