[geary/wip/limit-replay-op-retries] Replay ops that ignore remote errors should only ignore remote errors



commit 4fe1fcdeb9466d30db3e566593bd5ed473588d27
Author: Michael Gratton <mike vee net>
Date:   Thu Feb 7 13:43:52 2019 +1100

    Replay ops that ignore remote errors should only ignore remote errors
    
    Rename OnError.IGNORE to make it clear it is for remote errors only,
    ensure only remote errors are ignored for ops that use it.

 src/engine/imap-engine/imap-engine-replay-operation.vala  |  2 +-
 src/engine/imap-engine/imap-engine-replay-queue.vala      | 15 ++++++++-------
 .../replay-ops/imap-engine-abstract-list-email.vala       |  2 +-
 .../imap-engine/replay-ops/imap-engine-replay-append.vala |  2 +-
 .../replay-ops/imap-engine-replay-removal.vala            |  2 +-
 5 files changed, 12 insertions(+), 11 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-replay-operation.vala 
b/src/engine/imap-engine/imap-engine-replay-operation.vala
index 821b0f80..ab2d891d 100644
--- a/src/engine/imap-engine/imap-engine-replay-operation.vala
+++ b/src/engine/imap-engine/imap-engine-replay-operation.vala
@@ -42,7 +42,7 @@ private abstract class Geary.ImapEngine.ReplayOperation : Geary.BaseObject, Gee.
     public enum OnError {
         THROW,
         RETRY,
-        IGNORE
+        IGNORE_REMOTE
     }
 
     public string name { get; set; }
diff --git a/src/engine/imap-engine/imap-engine-replay-queue.vala 
b/src/engine/imap-engine/imap-engine-replay-queue.vala
index 3d839775..7cda1c45 100644
--- a/src/engine/imap-engine/imap-engine-replay-queue.vala
+++ b/src/engine/imap-engine/imap-engine-replay-queue.vala
@@ -37,7 +37,7 @@ private class Geary.ImapEngine.ReplayQueue : Geary.BaseObject {
 
         public CloseReplayQueue() {
             // LOCAL_AND_REMOTE to make sure this operation is flushed all the way down the pipe
-            base ("CloseReplayQueue", ReplayOperation.Scope.LOCAL_AND_REMOTE, OnError.IGNORE);
+            base ("CloseReplayQueue", ReplayOperation.Scope.LOCAL_AND_REMOTE, OnError.IGNORE_REMOTE);
         }
 
         public override async ReplayOperation.Status replay_local_async()
@@ -530,7 +530,7 @@ private class Geary.ImapEngine.ReplayQueue : Geary.BaseObject {
 
                     // If a recoverable failure and operation allows
                     // remote replay and not closing, re-schedule now
-                    if (op.on_remote_error == ReplayOperation.OnError.RETRY &&
+                    if (op.on_remote_error == RETRY &&
                         op.remote_retry_count <= MAX_OP_RETRIES &&
                         !is_unrecoverable_failure(replay_err) &&
                         state == State.OPEN) {
@@ -541,15 +541,16 @@ private class Geary.ImapEngine.ReplayQueue : Geary.BaseObject {
                         // normalized
                         op.remote_retry_count++;
                         remote_queue.send(op);
-                        
+
                         continue;
-                    } else if (op.on_remote_error == ReplayOperation.OnError.IGNORE) {
+                    } else if (op.on_remote_error == IGNORE_REMOTE &&
+                               is_remote_error(replay_err)) {
                         // ignoring error, simply notify as completed and continue
-                        debug("Ignoring op %s on %s", op.to_string(), to_string());
+                        debug("Ignoring remote error op %s on %s", op.to_string(), to_string());
                     } else {
-                        debug("Throwing remote error for op %s on %s: %s", op.to_string(), to_string(),
+                        debug("Throwing error for op %s on %s: %s", op.to_string(), to_string(),
                             replay_err.message);
-                        
+
                         // store for notification
                         remote_err = replay_err;
                     }
diff --git a/src/engine/imap-engine/replay-ops/imap-engine-abstract-list-email.vala 
b/src/engine/imap-engine/replay-ops/imap-engine-abstract-list-email.vala
index d58a232a..8adf79e2 100644
--- a/src/engine/imap-engine/replay-ops/imap-engine-abstract-list-email.vala
+++ b/src/engine/imap-engine/replay-ops/imap-engine-abstract-list-email.vala
@@ -82,7 +82,7 @@ private abstract class Geary.ImapEngine.AbstractListEmail : Geary.ImapEngine.Sen
     
     public AbstractListEmail(string name, MinimalFolder owner, Geary.Email.Field required_fields,
         Folder.ListFlags flags, Cancellable? cancellable) {
-        base(name, OnError.IGNORE);
+        base(name, OnError.IGNORE_REMOTE);
         
         this.owner = owner;
         this.required_fields = required_fields;
diff --git a/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala 
b/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala
index 7fbb05c3..9a5f9165 100644
--- a/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala
+++ b/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala
@@ -22,7 +22,7 @@ private class Geary.ImapEngine.ReplayAppend : Geary.ImapEngine.ReplayOperation {
                         Cancellable? cancellable) {
         // IGNORE remote errors because the reconnect will re-normalize the folder, making this
         // append moot
-        base ("Append", Scope.REMOTE_ONLY, OnError.IGNORE);
+        base ("Append", Scope.REMOTE_ONLY, OnError.IGNORE_REMOTE);
 
         this.owner = owner;
         this.remote_count = remote_count;
diff --git a/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala 
b/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala
index 1ff5b7c7..d42388e4 100644
--- a/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala
+++ b/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala
@@ -17,7 +17,7 @@ private class Geary.ImapEngine.ReplayRemoval : Geary.ImapEngine.ReplayOperation
 
     public ReplayRemoval(MinimalFolder owner, int remote_count, Imap.SequenceNumber position) {
         // remote error will cause folder to reconnect and re-normalize, making this remove moot
-        base ("Removal", Scope.LOCAL_AND_REMOTE, OnError.IGNORE);
+        base ("Removal", Scope.LOCAL_AND_REMOTE, OnError.IGNORE_REMOTE);
         
         this.owner = owner;
         this.remote_count = remote_count;


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