[geary/mjog/797-sync-recoverable-error-loop-followup] ImapEngine.MinimalFolder: Fix embarrassing logic bug in commit 117051e5




commit 29b3407139bad6ba7a9836e6c066af0265f5a491
Author: Michael Gratton <mike vee net>
Date:   Wed Sep 2 13:25:28 2020 +1000

    ImapEngine.MinimalFolder: Fix embarrassing logic bug in commit 117051e5
    
    See !571
    
    Fixes #964

 src/engine/imap-engine/imap-engine-minimal-folder.vala | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala 
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index ee2f97b14..a004e1844 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -304,8 +304,9 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
         throws GLib.Error {
         check_open("synchronise_remote");
 
+        bool have_nooped = false;
         int retries = 3;
-        while (retries > 0 && !cancellable.is_cancelled()) {
+        while (!have_nooped && !cancellable.is_cancelled()) {
             // The normalisation process will pick up any missing
             // messages if closed, so ensure there is a remote
             // session.
@@ -323,8 +324,10 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
                 // 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) && retries > 1) {
+                retries =- 1;
+                if (is_recoverable_failure(err) && retries > 0) {
                     // XXX In theory we should be able to just retry
                     // this immediately, but there's a race between
                     // the old connection being disposed and another
@@ -333,7 +336,6 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
                     // reties and set a timeout to help aid recovery.
                     debug("Recoverable error during remote sync: %s",
                           err.message);
-                    retries--;
                     GLib.Timeout.add_seconds(
                         1, this.synchronise_remote.callback
                     );


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]