diff --git a/packages/nylas-sync/sync-process-manager.js b/packages/nylas-sync/sync-process-manager.js index 3d205c384..d1ee98c9f 100644 --- a/packages/nylas-sync/sync-process-manager.js +++ b/packages/nylas-sync/sync-process-manager.js @@ -194,13 +194,14 @@ class SyncProcessManager { const dst = ACCOUNTS_UNCLAIMED; return PubsubConnector.broadcastClient().lremAsync(src, 1, accountId).then((didRemove) => { + this._workers[accountId] = null; + if (didRemove) { PubsubConnector.broadcastClient().rpushAsync(dst, accountId) } else { this._logger.error("Wanted to return item to pool, but didn't have claim on it.") return } - this._workers[accountId] = null; }); } } diff --git a/packages/nylas-sync/sync-worker.js b/packages/nylas-sync/sync-worker.js index 992ef3a52..1b6c7c801 100644 --- a/packages/nylas-sync/sync-worker.js +++ b/packages/nylas-sync/sync-worker.js @@ -225,6 +225,7 @@ class SyncWorker { this._account.lastSyncCompletions = lastSyncCompletions this._account.save() + this._logger.info('Syncworker: Completed sync cycle') if (afterSync === 'idle') {