From d019d7ae9f0d97b4eea4f94c8808f59b4ca6fdb8 Mon Sep 17 00:00:00 2001 From: Chris Heywood <15127-creywood@users.noreply.gitlab.gnome.org> Date: Thu, 9 Jan 2020 13:00:52 +0100 Subject: [PATCH] Move, rename and document property --- src/engine/api/geary-account-information.vala | 2 -- src/engine/api/geary-account.vala | 12 ++++++++++++ .../imap-engine/imap-engine-generic-account.vala | 4 ++-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/engine/api/geary-account-information.vala b/src/engine/api/geary-account-information.vala index 60c42e7a..6c8c06f2 100644 --- a/src/engine/api/geary-account-information.vala +++ b/src/engine/api/geary-account-information.vala @@ -210,8 +210,6 @@ public class Geary.AccountInformation : BaseObject { default = new Gee.LinkedList(); } - public DateTime? last_backgrounded_cleanup_time { get; set; default = null; } - /** * Emitted when a service has reported an authentication failure. * diff --git a/src/engine/api/geary-account.vala b/src/engine/api/geary-account.vala index d9100c1c..5e2641b4 100644 --- a/src/engine/api/geary-account.vala +++ b/src/engine/api/geary-account.vala @@ -145,6 +145,18 @@ public abstract class Geary.Account : BaseObject, Logging.Source { public ProgressMonitor db_upgrade_monitor { get; protected set; } public ProgressMonitor db_vacuum_monitor { get; protected set; } + /** + * The last time the account storage was cleaned. + * + * This does not imply that a full reap plus vacuum garbage + * collection (GC) is performed, merely that: + * 1. Any old messages are removed + * 2. If any old messages were removed, or the defined period + * (in ImapDB.GC) has past, a GC reap is performed + * 3. GC vacuum is run if recommended + */ + public DateTime? last_storage_cleanup { get; set; default = null; } + public signal void opened(); diff --git a/src/engine/imap-engine/imap-engine-generic-account.vala b/src/engine/imap-engine/imap-engine-generic-account.vala index dc8ade26..a6b4f2d5 100644 --- a/src/engine/imap-engine/imap-engine-generic-account.vala +++ b/src/engine/imap-engine/imap-engine-generic-account.vala @@ -535,12 +535,12 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account { debug("Backgrounded cleanup check for %s account", this.information.display_name); DateTime now = new DateTime.now_local(); - DateTime? last_cleanup = this.information.last_backgrounded_cleanup_time; + DateTime? last_cleanup = this.last_storage_cleanup; if (last_cleanup == null || (now.difference(last_cleanup) / TimeSpan.MINUTE > APP_BACKGROUNDED_CLEANUP_WORK_INTERVAL_MINUTES)) { // Interval check is OK, start by detaching old messages - this.information.last_backgrounded_cleanup_time = now; + this.last_storage_cleanup = now; this.old_messages_background_cleanup_request(cancellable); } else if (local.db.want_background_vacuum) { // Vacuum has been flagged as needed, run it