mirror of
https://github.com/renovatebot/renovate.git
synced 2025-01-12 23:16:26 +00:00
refactor(github): retry abuse detection ony once
This commit is contained in:
parent
9295efecdd
commit
99014ff973
1 changed files with 15 additions and 12 deletions
|
@ -117,24 +117,27 @@ async function get(path, options, retries = 5) {
|
|||
throw new Error('platform-failure');
|
||||
}
|
||||
if (
|
||||
retries > 0 &&
|
||||
err.statusCode === 403 &&
|
||||
err.message &&
|
||||
err.message.startsWith('You have triggered an abuse detection mechanism')
|
||||
) {
|
||||
logger.info(
|
||||
{
|
||||
headers: err.headers,
|
||||
path,
|
||||
statusCode: err.statusCode,
|
||||
message: err.message,
|
||||
},
|
||||
`Retrying request`
|
||||
);
|
||||
if (retries > 0) {
|
||||
logger.info(
|
||||
{
|
||||
headers: err.headers,
|
||||
path,
|
||||
statusCode: err.statusCode,
|
||||
message: err.message,
|
||||
},
|
||||
`Retrying request`
|
||||
);
|
||||
|
||||
await delay(180000 / (retries * retries));
|
||||
await delay(180000 / (retries * retries));
|
||||
|
||||
return get(path, opts, retries - 1);
|
||||
return get(path, opts, 0);
|
||||
}
|
||||
// istanbul ignore next
|
||||
throw new Error('platform-failure');
|
||||
}
|
||||
if (
|
||||
err.statusCode === 403 &&
|
||||
|
|
Loading…
Reference in a new issue