[geary/wip/131-sent-mail: 50/52] MinimalFolder::synchronise_remote: Handle sessions gone bad
- From: Michael Gratton <mjog src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/131-sent-mail: 50/52] MinimalFolder::synchronise_remote: Handle sessions gone bad
- Date: Mon, 26 Aug 2019 03:27:46 +0000 (UTC)
commit 595179a9d160154318235261a051fa36e1f5ba60
Author: Michael Gratton <mike vee net>
Date: Sun Aug 25 16:49:16 2019 +1000
MinimalFolder::synchronise_remote: Handle sessions gone bad
Since the NOOP that ::synchronise_remote sends doesn't go through the
replay queue, it will throw an error if the connection has gone bad.
Instead, catch it and retry.
.../imap-engine/imap-engine-minimal-folder.vala | 35 ++++++++++++++++++----
1 file changed, 29 insertions(+), 6 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index 1347c7d4..3f3bc1fe 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -282,13 +282,36 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
public override async void synchronise_remote(GLib.Cancellable? cancellable)
throws GLib.Error {
check_open("synchronise_remote");
- // The normalisation process will pick up any missing messages
- // if closed so ensure there is a remote session
- Imap.FolderSession remote = yield claim_remote_session(cancellable);
- // Send a NOOP so the server can return an untagged EXISTS if
- // any new messages have arrived since the remote was opened.
- yield remote.send_noop(cancellable);
+ bool have_nooped = false;
+ while (!have_nooped && !cancellable.is_cancelled()) {
+ // The normalisation process will pick up any missing
+ // messages if closed, so ensure there is a remote
+ // session.
+ Imap.FolderSession? remote =
+ yield claim_remote_session(cancellable);
+
+ try {
+ // Send a NOOP so the server can return an untagged
+ // EXISTS if any new messages have arrived since the
+ // remote was opened.
+ //
+ // This is important for servers like GMail that
+ // automatically save sent mail, since the Sent folder
+ // will already be open, but unless the client is also
+ // showing the Sent folder, IDLE won't be enabled and
+ // hence we won't get notified of the saved mail.
+ yield remote.send_noop(cancellable);
+ have_nooped = true;
+ } catch (GLib.Error err) {
+ if (is_recoverable_failure(err)) {
+ debug("Recoverable error during remote sync: %s",
+ err.message);
+ } else {
+ throw err;
+ }
+ }
+ }
// Wait until the replay queue has processed all notifications
// so the prefetcher becomes aware of the new mail
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]