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,11 +117,11 @@ async function get(path, options, retries = 5) {
|
||||||
throw new Error('platform-failure');
|
throw new Error('platform-failure');
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
retries > 0 &&
|
|
||||||
err.statusCode === 403 &&
|
err.statusCode === 403 &&
|
||||||
err.message &&
|
err.message &&
|
||||||
err.message.startsWith('You have triggered an abuse detection mechanism')
|
err.message.startsWith('You have triggered an abuse detection mechanism')
|
||||||
) {
|
) {
|
||||||
|
if (retries > 0) {
|
||||||
logger.info(
|
logger.info(
|
||||||
{
|
{
|
||||||
headers: err.headers,
|
headers: err.headers,
|
||||||
|
@ -134,7 +134,10 @@ async function get(path, options, retries = 5) {
|
||||||
|
|
||||||
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 (
|
if (
|
||||||
err.statusCode === 403 &&
|
err.statusCode === 403 &&
|
||||||
|
|
Loading…
Reference in a new issue