diff --git a/package.json b/package.json index bfc0286dc..fad90a3b6 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "accept-language-parser": "1.4.1", - "async": "1.5.2", + "async": "^2.6.0", "basic-auth-connect": "^1.0.0", "body-parser": "1.18.2", "builtin-modules": "^2.0.0", diff --git a/src/registry/domain/components-details.js b/src/registry/domain/components-details.js index f650e5abc..2369b7ff6 100644 --- a/src/registry/domain/components-details.js +++ b/src/registry/domain/components-details.js @@ -21,35 +21,34 @@ module.exports = (conf, cdn) => { const details = _.extend({}, _.cloneDeep(options.details)); details.components = details.components || {}; - async.eachOfSeries( - options.componentsList.components, - (versions, name, done) => { - details.components[name] = details.components[name] || {}; + const missing = []; + _.each(options.componentsList.components, (versions, name) => { + details.components[name] = details.components[name] || {}; + _.each(versions, version => { + if (!details.components[name][version]) { + missing.push({ name, version }); + } + }); + }); - async.eachLimit( - versions, - cdn.maxConcurrentRequests, - (version, next) => { - if (details.components[name][version]) { - next(); - } else { - cdn.getJson( - `${conf.storage.options - .componentsDir}/${name}/${version}/package.json`, - true, - (err, content) => { - if (err) { - return next(err); - } - details.components[name][version] = { - publishDate: content.oc.date || 0 - }; - next(); - } - ); + async.eachLimit( + missing, + cdn.maxConcurrentRequests, + ({ name, version }, next) => { + cdn.getJson( + `${conf.storage.options.componentsDir}/${name}/${ + version + }/package.json`, + true, + (err, content) => { + if (err) { + return next(err); } - }, - done + details.components[name][version] = { + publishDate: content.oc.date || 0 + }; + next(); + } ); }, err =>