Merge branch 'mjog/797-sync-recoverable-error-loop-followup' into 'mainline'

ImapEngine.MinimalFolder: Fix embarrassing logic bug in commit 117051e5

Closes #964

See merge request GNOME/geary!573
This commit is contained in:
Michael Gratton 2020-09-02 04:02:32 +00:00
commit 83156acf34

View file

@ -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
);