[geary/wip/713150-conversations] Don't re-load previously-seen email identifiers when pulling conversations
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary/wip/713150-conversations] Don't re-load previously-seen email identifiers when pulling conversations
- Date: Thu, 19 Mar 2015 01:52:16 +0000 (UTC)
commit 46a3e2e1fec752b76523f6598a704c389ff413c7
Author: Jim Nelson <jim yorba org>
Date: Wed Mar 18 18:51:14 2015 -0700
Don't re-load previously-seen email identifiers when pulling conversations
This means that a Folder w/ FolderSupport.Associations will always pull
fresh associations each call, with no overlap with prior-loaded associations.
.../api/geary-folder-supports-associations.vala | 8 +++++++-
src/engine/app/app-conversation-monitor.vala | 3 ++-
src/engine/imap-db/imap-db-folder.vala | 7 ++++++-
.../imap-engine/imap-engine-minimal-folder.vala | 6 ++++--
4 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/src/engine/api/geary-folder-supports-associations.vala
b/src/engine/api/geary-folder-supports-associations.vala
index 1f1a8fe..9886972 100644
--- a/src/engine/api/geary-folder-supports-associations.vala
+++ b/src/engine/api/geary-folder-supports-associations.vala
@@ -42,13 +42,19 @@ public interface Geary.FolderSupport.Associations : Geary.Folder {
* identifier of the returned collection can be used as the initial_id for the next call to
* this method.
*
+ * already_seen_ids allows for the caller to supply a collection of all previously loaded (seen)
+ * EmailIdentifiers from prior calls (either from this method or
+ * { link Account.local_search_associated_emails_async}) indicating that if they are encountered
+ * while listing, don't load associations for that identifier.
+ *
* This only lists Email stored in the local store.
*
* @see Geary.Folder.find_boundaries_async
*/
public abstract async Gee.Collection<Geary.AssociatedEmails>? local_list_associated_emails_async(
Geary.EmailIdentifier? initial_id, int count, Geary.Account.EmailSearchPredicate? predicate,
- Gee.Collection<Geary.EmailIdentifier>? primary_email_ids, Cancellable? cancellable = null)
+ Gee.Collection<Geary.EmailIdentifier>? primary_loaded_ids,
+ Gee.Collection<Geary.EmailIdentifier>? already_seen_ids, Cancellable? cancellable = null)
throws Error;
}
diff --git a/src/engine/app/app-conversation-monitor.vala b/src/engine/app/app-conversation-monitor.vala
index 7a16496..8b7f5df 100644
--- a/src/engine/app/app-conversation-monitor.vala
+++ b/src/engine/app/app-conversation-monitor.vala
@@ -489,7 +489,8 @@ public class Geary.App.ConversationMonitor : BaseObject {
Gee.Collection<EmailIdentifier> primary_email_ids = new Gee.HashSet<EmailIdentifier>();
try {
associations = yield supports_associations.local_list_associated_emails_async(
- low_id, count, predicate_instance.search_predicate, primary_email_ids, cancellable);
+ low_id, count, predicate_instance.search_predicate, primary_email_ids,
+ all_email_id_to_conversation.keys, cancellable);
} catch (Error err) {
debug("Unable to load associated emails from %s: %s", supports_associations.to_string(),
err.message);
diff --git a/src/engine/imap-db/imap-db-folder.vala b/src/engine/imap-db/imap-db-folder.vala
index c2714ab..c437f8f 100644
--- a/src/engine/imap-db/imap-db-folder.vala
+++ b/src/engine/imap-db/imap-db-folder.vala
@@ -599,7 +599,8 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
public async Gee.Collection<Geary.AssociatedEmails>? list_associated_emails_async(
ImapDB.EmailIdentifier? start_id, int count, Geary.Account.EmailSearchPredicate? predicate,
- Gee.Collection<Geary.EmailIdentifier>? primary_email_ids, Cancellable? cancellable) throws Error {
+ Gee.Collection<Geary.EmailIdentifier>? primary_email_ids,
+ Gee.Collection<Geary.EmailIdentifier>? already_seen_ids, Cancellable? cancellable) throws Error {
if (count == 0)
return null;
@@ -639,6 +640,10 @@ private class Geary.ImapDB.Folder : BaseObject, Geary.ReferenceSemantics {
ImapDB.EmailIdentifier id = new ImapDB.EmailIdentifier(result.int64_at(0),
new Imap.UID(result.int64_at(1)));
+ // if caller loaded this previously, don't load again
+ if (already_seen_ids != null && already_seen_ids.contains(id))
+ continue;
+
// add this one to the list of primary (vector) email identifiers associations are
// keying off of
if (primary_email_ids != null)
diff --git a/src/engine/imap-engine/imap-engine-minimal-folder.vala
b/src/engine/imap-engine/imap-engine-minimal-folder.vala
index b347ef3..f029181 100644
--- a/src/engine/imap-engine/imap-engine-minimal-folder.vala
+++ b/src/engine/imap-engine/imap-engine-minimal-folder.vala
@@ -1480,7 +1480,9 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
public virtual async Gee.Collection<AssociatedEmails>? local_list_associated_emails_async(
EmailIdentifier? initial_id, int count, Account.EmailSearchPredicate? predicate,
- Gee.Collection<EmailIdentifier>? primary_email_ids, Cancellable? cancellable = null) throws Error {
+ Gee.Collection<EmailIdentifier>? primary_email_ids,
+ Gee.Collection<Geary.EmailIdentifier>? already_seen_ids, Cancellable? cancellable = null)
+ throws Error {
check_open("local_list_associated_emails_async");
if (initial_id != null)
check_id("local_list_associated_emails_async", initial_id);
@@ -1491,7 +1493,7 @@ private class Geary.ImapEngine.MinimalFolder : Geary.Folder, Geary.FolderSupport
throw new EngineError.BAD_PARAMETERS("count may not be negative");
return yield local_folder.list_associated_emails_async((ImapDB.EmailIdentifier) initial_id,
- count, predicate, primary_email_ids, cancellable);
+ count, predicate, primary_email_ids, already_seen_ids, cancellable);
}
public void schedule_op(ReplayOperation op) throws Error {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]