promise-queue
Advanced tools
Comparing version 2.1.2 to 2.2.0
@@ -136,3 +136,2 @@ /* global define, Promise */ | ||
var self = this; | ||
if (this.pendingPromises >= this.maxPendingPromises) { | ||
@@ -148,22 +147,30 @@ return false; | ||
this.pendingPromises++; | ||
resolveWith(item.promiseGenerator()) | ||
try { | ||
this.pendingPromises++; | ||
resolveWith(item.promiseGenerator()) | ||
// Forward all stuff | ||
.then(function (value) { | ||
// It is not pending now | ||
self.pendingPromises--; | ||
self._dequeue(); | ||
// It should pass values | ||
item.resolve(value); | ||
}, function (err) { | ||
// It is not pending now | ||
self.pendingPromises--; | ||
self._dequeue(); | ||
// It should not mask errors | ||
item.reject(err); | ||
}, function (message) { | ||
// It should pass notifications | ||
item.notify(message); | ||
}); | ||
.then(function (value) { | ||
// It is not pending now | ||
self.pendingPromises--; | ||
// It should pass values | ||
item.resolve(value); | ||
self._dequeue(); | ||
}, function (err) { | ||
// It is not pending now | ||
self.pendingPromises--; | ||
// It should not mask errors | ||
item.reject(err); | ||
self._dequeue(); | ||
}, function (message) { | ||
// It should pass notifications | ||
item.notify(message); | ||
}); | ||
} catch (err) { | ||
self.pendingPromises--; | ||
item.reject(err); | ||
self._dequeue(); | ||
} | ||
return true; | ||
@@ -170,0 +177,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"name": "promise-queue", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"contributors": [ | ||
@@ -8,0 +8,0 @@ { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23744
511