Skip to content

Commit

Permalink
chore(abstract-mapreduce): cleanup taskqueue.js (pouchdb#8891)
Browse files Browse the repository at this point in the history
* chore(abstract-mapreduce): cleanup taskqueue.js

Co-authored-by: Gareth Bowen <[email protected]>
  • Loading branch information
SourceR85 and garethbowen authored Mar 30, 2024
1 parent 1866900 commit df73502
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
* callbacks will eventually fire (once).
*/


class TaskQueue {
constructor() {
this.promise = new Promise(function (fulfill) {fulfill(); });
this.promise = Promise.resolve();
}

add(promiseFactory) {
this.promise = this.promise.catch(function () {
this.promise = this.promise
// just recover
}).then(function () {
return promiseFactory();
});
.catch(() => { })
.then(() => promiseFactory());
return this.promise;
}

Expand Down

0 comments on commit df73502

Please sign in to comment.