mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-11 22:46:27 +00:00
fix(npm): randomize retry delay
This commit is contained in:
parent
89e2240016
commit
e71641363a
1 changed files with 7 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue