Skip to content

Commit df73502

Browse files
chore(abstract-mapreduce): cleanup taskqueue.js (pouchdb#8891)
* chore(abstract-mapreduce): cleanup taskqueue.js Co-authored-by: Gareth Bowen <[email protected]>
1 parent 1866900 commit df73502

File tree

1 file changed

+4
-6
lines changed
  • packages/node_modules/pouchdb-abstract-mapreduce/src

1 file changed

+4
-6
lines changed

packages/node_modules/pouchdb-abstract-mapreduce/src/taskqueue.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@
33
* callbacks will eventually fire (once).
44
*/
55

6-
76
class TaskQueue {
87
constructor() {
9-
this.promise = new Promise(function (fulfill) {fulfill(); });
8+
this.promise = Promise.resolve();
109
}
1110

1211
add(promiseFactory) {
13-
this.promise = this.promise.catch(function () {
12+
this.promise = this.promise
1413
// just recover
15-
}).then(function () {
16-
return promiseFactory();
17-
});
14+
.catch(() => { })
15+
.then(() => promiseFactory());
1816
return this.promise;
1917
}
2018

0 commit comments

Comments
 (0)