From 1a97f27fe3acb0ab3b85dc5584f76c05e8ac53cf Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Wed, 27 Apr 2016 02:34:46 -0400 Subject: [PATCH] Use Bluebird reflect() instead of deprecated settle() --- resource/concurrentCaller.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/resource/concurrentCaller.js b/resource/concurrentCaller.js index 34861b44a..19a08fd4a 100644 --- a/resource/concurrentCaller.js +++ b/resource/concurrentCaller.js @@ -105,16 +105,17 @@ ConcurrentCaller.prototype.pause = function (ms) { * Add a task to the queue without starting it * * @param {Function|Function[]} - One or more functions to run - * @return {Promise[]} - An array of promises for passed functions, resolved once they have all - * finished (even if other functions are still running) + * @return {Promise|Promise} - If one function is passed, a promise for the return + * value of the passed function; if multiple, a promise for an array of PromiseInspection objects + * for those functions, resolved once they have all finished, even if other functions are still running */ ConcurrentCaller.prototype.add = function (func) { if (Array.isArray(func)) { let promises = []; for (let i = 0; i < func.length; i++) { - promises.push(this.start(func[i])); + promises.push(this.start(func[i]).reflect()); } - return Promise.settle(promises); + return Promise.all(promises); } if (!this._deferred || !this._deferred.promise.isPending()) {