mirror of
https://github.com/Foundry376/Mailspring.git
synced 2025-03-03 19:43:04 +08:00
[local-sync] protection from reset action being double-fired
Summary: Double-firing protection since the DatabaseStore can now fire this Test Plan: manual Reviewers: juan Reviewed By: juan Differential Revision: https://phab.nylas.com/D3730
This commit is contained in:
parent
02cf6fbf6e
commit
a124b6c100
1 changed files with 5 additions and 1 deletions
|
@ -36,11 +36,14 @@ class SyncProcessManager {
|
||||||
|
|
||||||
Actions.wakeLocalSyncWorkerForAccount.listen((accountId) =>
|
Actions.wakeLocalSyncWorkerForAccount.listen((accountId) =>
|
||||||
this.wakeWorkerForAccount(accountId)
|
this.wakeWorkerForAccount(accountId)
|
||||||
)
|
);
|
||||||
|
this._resettingEmailCache = false
|
||||||
Actions.resetEmailCache.listen(this._resetEmailCache, this)
|
Actions.resetEmailCache.listen(this._resetEmailCache, this)
|
||||||
}
|
}
|
||||||
|
|
||||||
_resetEmailCache() {
|
_resetEmailCache() {
|
||||||
|
if (this._resettingEmailCache) return;
|
||||||
|
this._resettingEmailCache = true
|
||||||
try {
|
try {
|
||||||
for (const worker of this.workers()) {
|
for (const worker of this.workers()) {
|
||||||
worker.stopSync()
|
worker.stopSync()
|
||||||
|
@ -57,6 +60,7 @@ class SyncProcessManager {
|
||||||
}, 100)
|
}, 100)
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
this._resettingEmailCache = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue