Mailspring/sync/sync-worker-pool.js

17 lines
416 B
JavaScript
Raw Normal View History

2016-06-19 18:02:32 +08:00
const SyncWorker = require('./sync-worker');
const DatabaseConnectionFactory = require(`${__base}/core/database-connection-factory`)
class SyncWorkerPool {
constructor() {
this._workers = {};
}
addWorkerForAccount(account) {
DatabaseConnectionFactory.forAccount(account.id).then((db) => {
this._workers[account.id] = new SyncWorker(account, db);
});
}
}
module.exports = SyncWorkerPool;