Fix accounts syncing in a hard loop due to redis loopback

This commit is contained in:
Ben Gotow 2016-07-15 10:07:33 -07:00
parent 13a723e663
commit ac3f96e2d4

View file

@ -73,11 +73,14 @@ class SyncWorker {
}
_onAccountUpdated() {
if (!this.isWaitingForNextSync()) {
const syncingNow = !this.isWaitingForNextSync()
const syncingJustFinished = (Date.now() - this._lastSyncTime < 5000);
if (syncingNow || syncingJustFinished) {
return;
}
this._getAccount()
.then((account) => {
this._getAccount().then((account) => {
this._account = account;
this.syncNow({reason: 'Account Modification'});
})