[geary/mjog/folder-load-sync-race: 4/6] Geary.ImapEngine.GenericAccount: Start both remote services later




commit 41359e2d4a7584d15630c368f4d16206f6a294e2
Author: Michael Gratton <mike vee net>
Date:   Tue Feb 9 01:03:39 2021 +1100

    Geary.ImapEngine.GenericAccount: Start both remote services later
    
    Start both IMAP and SMTP services only after local folders have
    fully loaded, to avoid a race between folders being first updated from
    the remote, and full sync's being attempted on them.

 src/engine/imap-engine/imap-engine-generic-account.vala | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
---
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index 7ead30118..dac70d7fa 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -156,11 +156,10 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
 
         this.queue_operation(new LoadFolders(this, this.local));
 
-        // Start the mail services. Start incoming directly, but queue
-        // outgoing so local folders can be loaded first in case
-        // queued mail gets sent and needs to get saved somewhere.
-        yield this.imap.start(cancellable);
-        this.queue_operation(new StartPostie(this, this.smtp.outbox));
+        // Start remote mail services after local folders have been
+        // loaded in case queued mail gets sent and needs to get saved
+        // somewhere
+        this.queue_operation(new StartServices(this, this.smtp.outbox));
 
         // Kick off a background update of the search table.
         //
@@ -1192,21 +1191,23 @@ internal class Geary.ImapEngine.LoadFolders : AccountOperation {
 
 
 /**
- * Account operation for starting the outgoing service.
+ * Account operation for starting remote mail services.
  */
-internal class Geary.ImapEngine.StartPostie : AccountOperation {
+internal class Geary.ImapEngine.StartServices : AccountOperation {
 
 
     private Outbox.Folder outbox;
 
 
-    internal StartPostie(Account account, Outbox.Folder outbox) {
+    internal StartServices(Account account, Outbox.Folder outbox) {
         base(account);
         this.outbox = outbox;
     }
 
     public override async void execute(GLib.Cancellable cancellable)
         throws GLib.Error {
+        yield this.account.incoming.start(cancellable);
+
         this.account.register_local_folder(this.outbox);
         yield this.account.outgoing.start(cancellable);
     }


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