[geary] Reduce local delays when new message arrives
- From: Jim Nelson <jnelson src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [geary] Reduce local delays when new message arrives
- Date: Mon, 3 Feb 2014 22:14:28 +0000 (UTC)
commit 6833f1eab9dd3edc26a530852e16348f73469e38
Author: Jim Nelson <jim yorba org>
Date: Mon Feb 3 14:08:32 2014 -0800
Reduce local delays when new message arrives
In particular, bug #713493 reports this, although this patch doesn't
appear to solve the problem entirely. However, I have spotted
situations in the past where the Append replay operation caused local
operations to hang. This is because Append was being treated as a
local operation when, in fact, it's first call is back to the server
to fetch UIDs of the new messages. Hence, it should be treated as
a remote operation so local operations can run without delay.
src/CMakeLists.txt | 1 -
.../imap-engine/imap-engine-generic-folder.vala | 8 -------
.../imap-engine-receive-replay-operation.vala | 22 --------------------
.../replay-ops/imap-engine-replay-append.vala | 13 +++++++++--
.../replay-ops/imap-engine-replay-disconnect.vala | 12 +++++++++-
.../replay-ops/imap-engine-replay-removal.vala | 12 +++++++++-
6 files changed, 30 insertions(+), 38 deletions(-)
---
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9c38bab..be0c1b0 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -187,7 +187,6 @@ engine/imap-engine/imap-engine-generic-drafts-folder.vala
engine/imap-engine/imap-engine-generic-folder.vala
engine/imap-engine/imap-engine-generic-sent-mail-folder.vala
engine/imap-engine/imap-engine-generic-trash-folder.vala
-engine/imap-engine/imap-engine-receive-replay-operation.vala
engine/imap-engine/imap-engine-replay-operation.vala
engine/imap-engine/imap-engine-replay-queue.vala
engine/imap-engine/imap-engine-send-replay-operation.vala
diff --git a/src/engine/imap-engine/imap-engine-generic-folder.vala
b/src/engine/imap-engine/imap-engine-generic-folder.vala
index 6a53e3e..4b3d594 100644
--- a/src/engine/imap-engine/imap-engine-generic-folder.vala
+++ b/src/engine/imap-engine/imap-engine-generic-folder.vala
@@ -819,14 +819,6 @@ private class Geary.ImapEngine.GenericFolder : Geary.AbstractFolder, Geary.Folde
Gee.HashSet<Geary.EmailIdentifier> created = new Gee.HashSet<Geary.EmailIdentifier>();
Gee.HashSet<Geary.EmailIdentifier> appended = new Gee.HashSet<Geary.EmailIdentifier>();
try {
- // If remote doesn't fully open, then don't fire signal, as we'll be unable to
- // normalize the folder
- if (!yield remote_semaphore.wait_for_result_async(null)) {
- debug("%s do_replay_appended_message: remote never opened", to_string());
-
- return;
- }
-
Imap.MessageSet msg_set = new Imap.MessageSet.sparse(remote_positions.to_array());
Gee.List<Geary.Email>? list = yield remote_folder.list_email_async(msg_set,
ImapDB.Folder.REQUIRED_FIELDS, null);
diff --git a/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala
b/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala
index 32de08b..5d849cd 100644
--- a/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala
+++ b/src/engine/imap-engine/replay-ops/imap-engine-replay-append.vala
@@ -4,13 +4,13 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
-private class Geary.ImapEngine.ReplayAppend : Geary.ImapEngine.ReceiveReplayOperation {
+private class Geary.ImapEngine.ReplayAppend : Geary.ImapEngine.ReplayOperation {
public GenericFolder owner;
public int remote_count;
public Gee.List<Imap.SequenceNumber> positions;
public ReplayAppend(GenericFolder owner, int remote_count, Gee.List<Imap.SequenceNumber> positions) {
- base ("Append");
+ base ("Append", Scope.REMOTE_ONLY);
this.owner = owner;
this.remote_count = remote_count;
@@ -43,7 +43,14 @@ private class Geary.ImapEngine.ReplayAppend : Geary.ImapEngine.ReceiveReplayOper
public override void get_ids_to_be_remote_removed(Gee.Collection<ImapDB.EmailIdentifier> ids) {
}
- public override async ReplayOperation.Status replay_local_async() {
+ public override async ReplayOperation.Status replay_local_async() throws Error {
+ return ReplayOperation.Status.CONTINUE;
+ }
+
+ public override async void backout_local_async() throws Error {
+ }
+
+ public override async ReplayOperation.Status replay_remote_async() {
if (positions.size > 0)
yield owner.do_replay_appended_messages(remote_count, positions);
diff --git a/src/engine/imap-engine/replay-ops/imap-engine-replay-disconnect.vala
b/src/engine/imap-engine/replay-ops/imap-engine-replay-disconnect.vala
index 4903990..2582473 100644
--- a/src/engine/imap-engine/replay-ops/imap-engine-replay-disconnect.vala
+++ b/src/engine/imap-engine/replay-ops/imap-engine-replay-disconnect.vala
@@ -4,12 +4,12 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
-private class Geary.ImapEngine.ReplayDisconnect : Geary.ImapEngine.ReceiveReplayOperation {
+private class Geary.ImapEngine.ReplayDisconnect : Geary.ImapEngine.ReplayOperation {
public GenericFolder owner;
public Imap.ClientSession.DisconnectReason reason;
public ReplayDisconnect(GenericFolder owner, Imap.ClientSession.DisconnectReason reason) {
- base ("Disconnect");
+ base ("Disconnect", Scope.LOCAL_ONLY);
this.owner = owner;
this.reason = reason;
@@ -43,6 +43,14 @@ private class Geary.ImapEngine.ReplayDisconnect : Geary.ImapEngine.ReceiveReplay
return ReplayOperation.Status.COMPLETED;
}
+ public override async void backout_local_async() throws Error {
+ }
+
+ public override async ReplayOperation.Status replay_remote_async() throws Error {
+ // shot not be called
+ return ReplayOperation.Status.COMPLETED;
+ }
+
public override string describe_state() {
return "reason=%s".printf(reason.to_string());
}
diff --git a/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala
b/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala
index be4a24f..abc9d10 100644
--- a/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala
+++ b/src/engine/imap-engine/replay-ops/imap-engine-replay-removal.vala
@@ -4,13 +4,13 @@
* (version 2.1 or later). See the COPYING file in this distribution.
*/
-private class Geary.ImapEngine.ReplayRemoval : Geary.ImapEngine.ReceiveReplayOperation {
+private class Geary.ImapEngine.ReplayRemoval : Geary.ImapEngine.ReplayOperation {
public GenericFolder owner;
public int remote_count;
public Imap.SequenceNumber position;
public ReplayRemoval(GenericFolder owner, int remote_count, Imap.SequenceNumber position) {
- base ("Removal");
+ base ("Removal", Scope.LOCAL_ONLY);
this.owner = owner;
this.remote_count = remote_count;
@@ -36,6 +36,14 @@ private class Geary.ImapEngine.ReplayRemoval : Geary.ImapEngine.ReceiveReplayOpe
return ReplayOperation.Status.COMPLETED;
}
+ public override async void backout_local_async() throws Error {
+ }
+
+ public override async ReplayOperation.Status replay_remote_async() throws Error {
+ // should not be called
+ return ReplayOperation.Status.COMPLETED;
+ }
+
public override string describe_state() {
return "position=%s".printf(position.to_string());
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]