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.
This commit is contained in:
parent
a91854616a
commit
6833f1eab9
6 changed files with 30 additions and 38 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
/* Copyright 2011-2013 Yorba Foundation
|
||||
*
|
||||
* This software is licensed under the GNU Lesser General Public License
|
||||
* (version 2.1 or later). See the COPYING file in this distribution.
|
||||
*/
|
||||
|
||||
private abstract class Geary.ImapEngine.ReceiveReplayOperation : Geary.ImapEngine.ReplayOperation {
|
||||
public ReceiveReplayOperation(string name) {
|
||||
base (name, ReplayOperation.Scope.LOCAL_ONLY);
|
||||
}
|
||||
|
||||
public override async ReplayOperation.Status replay_remote_async() throws Error {
|
||||
debug("Warning: ReceiveReplayOperation.replay_remote_async() called");
|
||||
|
||||
return ReplayOperation.Status.COMPLETED;
|
||||
}
|
||||
|
||||
public override async void backout_local_async() throws Error {
|
||||
debug("Warning: ReceiveReplayOperation.backout_local_async() called");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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);
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue