From 8c44044cd1dcb129ab1e1ddefe5202dd06d809d3 Mon Sep 17 00:00:00 2001 From: Ben Newman Date: Tue, 7 Mar 2017 17:30:59 -0500 Subject: [PATCH] Ensure checkCount is decremented even if individual checks fail. --- packages/dynamic-import/cache.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/dynamic-import/cache.js b/packages/dynamic-import/cache.js index acbf6e1011..6c315f4618 100644 --- a/packages/dynamic-import/cache.js +++ b/packages/dynamic-import/cache.js @@ -63,6 +63,11 @@ exports.checkMany = function (versions) { ++checkCount; + function finish() { + --checkCount; + return sourcesById; + } + return Promise.all(ids.map(function (id) { return new Promise(function (resolve, reject) { var versionRequest = versionsById.get(id); @@ -85,10 +90,7 @@ exports.checkMany = function (versions) { } }; }); - })).then(function () { - --checkCount; - return sourcesById; - }); + })).then(finish, finish); }); };