[geary/mjog/folder-load-sync-race: 5/6] Geary.ImapEngine.GenericAccount: Use account sync API for db cleanup




commit 0f6c38be4c858cc1bb90750ce4abab188c1e7557
Author: Michael Gratton <mike vee net>
Date:   Tue Feb 9 01:05:50 2021 +1100

    Geary.ImapEngine.GenericAccount: Use account sync API for db cleanup
    
    Replace use of signals with direct method calls.

 src/client/application/application-controller.vala      | 8 ++++++--
 src/engine/imap-engine/imap-engine-generic-account.vala | 6 ++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
---
diff --git a/src/client/application/application-controller.vala 
b/src/client/application/application-controller.vala
index 93832fbf1..193176e6f 100644
--- a/src/client/application/application-controller.vala
+++ b/src/client/application/application-controller.vala
@@ -1719,10 +1719,14 @@ internal class Application.Controller :
         foreach (AccountContext context in this.accounts.values) {
             Geary.Account account = context.account;
             context.cancellable.cancelled.connect(this.storage_cleanup_cancellable.cancel);
-            yield account.cleanup_storage(this.storage_cleanup_cancellable);
+            try {
+                yield account.cleanup_storage(this.storage_cleanup_cancellable);
+            } catch (GLib.Error err) {
+                report_problem(new Geary.ProblemReport(err));
+            }
+            context.cancellable.cancelled.disconnect(this.storage_cleanup_cancellable.cancel);
             if (this.storage_cleanup_cancellable.is_cancelled())
                 break;
-            context.cancellable.cancelled.disconnect(this.storage_cleanup_cancellable.cancel);
         }
         this.storage_cleanup_cancellable = null;
     }
diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala 
b/src/engine/imap-engine/imap-engine-generic-account.vala
index dac70d7fa..34639439c 100644
--- a/src/engine/imap-engine/imap-engine-generic-account.vala
+++ b/src/engine/imap-engine/imap-engine-generic-account.vala
@@ -638,7 +638,9 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
     }
 
     /** {@inheritDoc} */
-    public override async void cleanup_storage(GLib.Cancellable? cancellable) {
+    public override async void cleanup_storage(GLib.Cancellable? cancellable)
+        throws GLib.Error {
+        check_open();
         debug("Backgrounded storage cleanup check for %s account", this.information.display_name);
 
         DateTime now = new DateTime.now_local();
@@ -648,7 +650,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
             (now.difference(last_cleanup) / TimeSpan.MINUTE > 
APP_BACKGROUNDED_CLEANUP_WORK_INTERVAL_MINUTES)) {
             // Interval check is OK, start by detaching old messages
             this.last_storage_cleanup = now;
-            this.old_messages_background_cleanup_request(cancellable);
+            this.sync.cleanup_storage();
         } else if (local.db.want_background_vacuum) {
             // Vacuum has been flagged as needed, run it
             local.db.run_gc.begin(


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