Geary.App.FillWindowOperation: detect stale FillWindowOperations
When a user types in the search box, there may still be oustanding FillWindowOperations queued on previous instances of SearchFolder from previous keystrokes. This can result in a FillWindowOperation with a stale value of ConversationMonitor.window_lowest from a previous search executing on the current one. Detect this and return immediately. Fixes: #838
This commit is contained in:
parent
bb02e157c6
commit
90711f234e
1 changed files with 18 additions and 6 deletions
|
|
@ -37,9 +37,16 @@ private class Geary.App.FillWindowOperation : ConversationOperation {
|
||||||
num_to_load = MAX_FILL_COUNT;
|
num_to_load = MAX_FILL_COUNT;
|
||||||
}
|
}
|
||||||
|
|
||||||
int loaded = yield this.monitor.load_by_id_async(
|
int loaded = 0;
|
||||||
|
|
||||||
|
try {
|
||||||
|
loaded = yield this.monitor.load_by_id_async(
|
||||||
this.monitor.window_lowest, num_to_load, LOCAL_ONLY
|
this.monitor.window_lowest, num_to_load, LOCAL_ONLY
|
||||||
);
|
);
|
||||||
|
} catch (EngineError.NOT_FOUND err) {
|
||||||
|
debug("Stale FillWindowOperation: %s", err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
debug(
|
debug(
|
||||||
"Filled %d of %d locally, window: %d, total: %d",
|
"Filled %d of %d locally, window: %d, total: %d",
|
||||||
|
|
@ -61,9 +68,14 @@ private class Geary.App.FillWindowOperation : ConversationOperation {
|
||||||
// Load the max amount if going to the trouble of talking
|
// Load the max amount if going to the trouble of talking
|
||||||
// to the remote.
|
// to the remote.
|
||||||
num_to_load = MAX_FILL_COUNT;
|
num_to_load = MAX_FILL_COUNT;
|
||||||
|
try {
|
||||||
loaded = yield this.monitor.load_by_id_async(
|
loaded = yield this.monitor.load_by_id_async(
|
||||||
this.monitor.window_lowest, num_to_load, FORCE_UPDATE
|
this.monitor.window_lowest, num_to_load, FORCE_UPDATE
|
||||||
);
|
);
|
||||||
|
} catch (EngineError.NOT_FOUND err) {
|
||||||
|
debug("Stale FillWindowOperation: %s", err.message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
debug(
|
debug(
|
||||||
"Filled %d of %d from the remote, window: %d, total: %d",
|
"Filled %d of %d from the remote, window: %d, total: %d",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue