Skip to content

Commit f27d269

Browse files
pseldendevongovett
authored andcommitted
fix PromiseQueue returning null when there are no jobs (#738)
* 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
1 parent 391e17f commit f27d269

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

src/utils/PromiseQueue.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,15 @@ class PromiseQueue {
2828
return this.runPromise;
2929
}
3030

31-
this.runPromise = new Promise((resolve, reject) => {
31+
const runPromise = new Promise((resolve, reject) => {
3232
this.resolve = resolve;
3333
this.reject = reject;
3434
});
3535

36+
this.runPromise = runPromise;
3637
this._next();
37-
return this.runPromise;
38+
39+
return runPromise;
3840
}
3941

4042
async _runJob(job, args) {

0 commit comments

Comments
 (0)