[geary/wip/789924-network-transition: 12/15] Don't delay opening remote folder when it is being waited on.



commit 2a0cfc31a78737e9b48d477eb0ec28954d836002
Author: Michael James Gratton <mike vee net>
Date:   Fri Nov 10 13:39:42 2017 +1100

    Don't delay opening remote folder when it is being waited on.
    
    * src/engine/imap-engine/imap-engine-minimal-folder.vala
      (MinimalFolder.wait_for_open_async): Cancel the timer if remote hasn't
      already opened, so it opens immediately.

 .../imap-engine/imap-engine-minimal-folder.vala    |    7 ++++---
 1 files changed, 4 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 243b716..365d42b 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -515,14 +515,15 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
     public override async void wait_for_open_async(Cancellable? cancellable = null) throws Error {
         if (open_count == 0)
             throw new EngineError.OPEN_REQUIRED("wait_for_open_async() can only be called after 
open_async()");
-        
+
         // if remote has not yet been opened, do it now ... this bool can go true only once after
         // an open_async, it's reset at close time
         if (!remote_opened) {
-            debug("wait_for_open_async %s: opening remote on demand...", to_string());
+            // Someone wants this open right now, so cancel the timer and just do it already
+            this.remote_open_timer.reset();
             start_open_remote();
         }
-        
+
         if (!yield remote_semaphore.wait_for_result_async(cancellable))
             throw new EngineError.ALREADY_CLOSED("%s failed to open", to_string());
     }


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