mirror of
https://github.com/chatmail/core.git
synced 2026-04-24 17:06:28 +03:00
Improve error handling of existing messages fetch and never retry
There are at least two user reports that fetching existing messages sometimes results in infinite loop of retrying it. Account is working if set up from the backup, but never starts working if set up from scratch. This change improves error reporting, but also sets FetchedExistingMsgs before actually trying to do it. This way if the operation fails, connection is reestablished, but fetching existing messages is not retried again over and over.
This commit is contained in:
@@ -141,6 +141,16 @@ async fn inbox_loop(ctx: Context, started: Sender<()>, inbox_handlers: ImapConne
|
||||
match ctx.get_config_bool(Config::FetchedExistingMsgs).await {
|
||||
Ok(fetched_existing_msgs) => {
|
||||
if !fetched_existing_msgs {
|
||||
// Consider it done even if we fail.
|
||||
//
|
||||
// This operation is not critical enough to retry,
|
||||
// especially if the error is persistent.
|
||||
if let Err(err) =
|
||||
ctx.set_config_bool(Config::FetchedExistingMsgs, true).await
|
||||
{
|
||||
warn!(ctx, "Can't set Config::FetchedExistingMsgs: {:#}", err);
|
||||
}
|
||||
|
||||
if let Err(err) = connection.fetch_existing_msgs(&ctx).await {
|
||||
warn!(ctx, "Failed to fetch existing messages: {:#}", err);
|
||||
connection.trigger_reconnect(&ctx);
|
||||
|
||||
Reference in New Issue
Block a user