diff --git a/packages/local-sync/src/local-sync-worker/sync-process-manager.js b/packages/local-sync/src/local-sync-worker/sync-process-manager.js index ae42ebcc6..27e4b814b 100644 --- a/packages/local-sync/src/local-sync-worker/sync-process-manager.js +++ b/packages/local-sync/src/local-sync-worker/sync-process-manager.js @@ -5,28 +5,6 @@ const {Actions} = require('nylas-exports') const SyncWorker = require('./sync-worker'); const LocalDatabaseConnector = require('../shared/local-database-connector') -/* -Accounts ALWAYS exist in either `accounts:unclaimed` or an `accounts:{id}` list. -They are atomically moved between these sets as they are claimed and returned. - -Periodically, each worker in the pool looks at all the `accounts:{id}` lists. -For each list it finds, it checks for the existence of `heartbeat:{id}`, a key -that expires quickly if the sync process doesn't refresh it. - -If it does not find the key, it moves all of the accounts in the list back to -the unclaimed key. - -Sync processes only claim an account for a fixed period of time. This means that -an engineer can add new sync machines to the pool and the load across instances -will balance on it's own. It also means one bad instance will not permanently -disrupt sync for any accounts. (Eg: instance has faulty network connection.) - -Sync processes periodically claim accounts when they can find them, regardless -of how busy they are. A separate API (`/routes/monitoring`) allows CloudWatch -to decide whether to spin up instances or take them offline based on CPU/RAM -utilization across the pool. -*/ - class SyncProcessManager { constructor() { this._workers = {};