[local-sync] Don't run interrupts within the sync-worker serially

Run them at the same time instead, using Promise.all()
This commit is contained in:
Halla Moore 2017-01-15 15:51:46 -08:00
parent fa6aec3cee
commit 450f6fde13

View file

@ -432,10 +432,11 @@ class SyncWorker {
async interrupt({reason = 'No reason'} = {}) {
console.log(`🔃 Interrupting sync! Reason: ${reason}`)
await this._interruptible.interrupt()
const interruptPromises = [await this._interruptible.interrupt()]
if (this._currentTask) {
await this._currentTask.interrupt()
interruptPromises.push(this._currentTask.interrupt())
}
await Promise.all(interruptPromises)
this._interrupted = true
}