diff --git a/lib/datasource/npm/get.ts b/lib/datasource/npm/get.ts index c7e84efd2307b97341c1a0370eb8d5b13a44aead..dc670aa1329f2331ee89d8e09fe2b56c2e8f9636 100644 --- a/lib/datasource/npm/get.ts +++ b/lib/datasource/npm/get.ts @@ -256,8 +256,13 @@ export async function getDependency( err.code === 'ETIMEDOUT') && retries > 0 ) { - logger.warn({ pkgUrl, errName: err.name }, 'Retrying npm error'); - await delay(5000); + // Delay a random time to avoid contention + const delaySeconds = 5 + Math.round(Math.random() * 25); + logger.warn( + { pkgUrl, errName: err.name, delaySeconds }, + 'Retrying npm error' + ); + await delay(1000 * delaySeconds); return getDependency(packageName, retries - 1); } if (err.name === 'ParseError' && err.body) {