Ensure checkCount is decremented even if individual checks fail.

This commit is contained in:
Ben Newman
2017-03-07 17:30:59 -05:00
parent 23e82bb1ef
commit 8c44044cd1

View File

@@ -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);
});
};