diff --git a/CHANGELOG.md b/CHANGELOG.md index 27304c77b..8c335f911 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ - Further improve finding the correct server after logging in #3208 - `get_connectivity_html()` returns HTML as non-scalable #3213 - add update-serial to `DC_EVENT_WEBXDC_STATUS_UPDATE` #3215 +- Speed up message receiving via IMAP a bit #3225 ## 1.77.0 diff --git a/src/scheduler.rs b/src/scheduler.rs index 6eb1886c9..87d8c234a 100644 --- a/src/scheduler.rs +++ b/src/scheduler.rs @@ -168,6 +168,13 @@ async fn fetch_idle(ctx: &Context, connection: &mut Imap, folder: Config) -> Int return connection.fake_idle(ctx, Some(watch_folder)).await; } + // Fetch the watched folder. + if let Err(err) = connection.fetch_move_delete(ctx, &watch_folder).await { + connection.trigger_reconnect(ctx).await; + warn!(ctx, "{:#}", err); + return InterruptInfo::new(false); + } + // Mark expired messages for deletion. if let Err(err) = delete_expired_imap_messages(ctx) .await @@ -176,13 +183,6 @@ async fn fetch_idle(ctx: &Context, connection: &mut Imap, folder: Config) -> Int warn!(ctx, "{:#}", err); } - // Fetch the watched folder. - if let Err(err) = connection.fetch_move_delete(ctx, &watch_folder).await { - connection.trigger_reconnect(ctx).await; - warn!(ctx, "{:#}", err); - return InterruptInfo::new(false); - } - // Scan additional folders only after finishing fetching the watched folder. // // On iOS the application has strictly limited time to work in background, so we may not