Skip to content

Commit

Permalink
fix PromiseQueue returning null when there are no jobs (#738)
Browse files Browse the repository at this point in the history
* fix PromiseQueue returning null when there are no jobs

When PromiseQueue is called with no jobs it returns null instead of a promise that is already resolved with an empty set. This causes "await run()" to evaluate to null, and a "Cannot read property 'Symbol(Symbol.iterator)' of null" error.

Fixes #664

* Formatting
  • Loading branch information
pselden authored and devongovett committed Feb 4, 2018
1 parent 391e17f commit f27d269
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/utils/PromiseQueue.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ class PromiseQueue {
return this.runPromise;
}

this.runPromise = new Promise((resolve, reject) => {
const runPromise = new Promise((resolve, reject) => {
this.resolve = resolve;
this.reject = reject;
});

this.runPromise = runPromise;
this._next();
return this.runPromise;

return runPromise;
}

async _runJob(job, args) {
Expand Down

0 comments on commit f27d269

Please sign in to comment.