fix(releases): add required octokit throttling rate limit handlers (#6338)
This commit is contained in:
1 parent
bf4ccd8cb3
commit
2d450239ac
2 files changed
+34
-5
No files matched your search
@@ -134,7 +134,33 @@ const getGithubApi = (baseUrl: string, userAgent: string, token?: string) =>
|
||||
baseUrl,
|
||||
auth: token,
|
||||
request: { fetch: fetchWithTrustedCertificatesAsync },
|
||||
throttle: { enabled: true },
|
||||
throttle: {
|
||||
enabled: true,
|
||||
onRateLimit: (
|
||||
retryAfter: number,
|
||||
options: { url?: string; method?: string },
|
||||
_octokit: unknown,
|
||||
retryCount: number,
|
||||
) => {
|
||||
logger.warn(`GitHub rate limit exceeded, retrying after ${retryAfter}s (attempt ${retryCount + 1})`, {
|
||||
url: options.url,
|
||||
method: options.method,
|
||||
});
|
||||
return retryCount < 1;
|
||||
},
|
||||
onSecondaryRateLimit: (
|
||||
retryAfter: number,
|
||||
options: { url?: string; method?: string },
|
||||
_octokit: unknown,
|
||||
retryCount: number,
|
||||
) => {
|
||||
logger.warn(`GitHub secondary rate limit exceeded, retrying after ${retryAfter}s (attempt ${retryCount + 1})`, {
|
||||
url: options.url,
|
||||
method: options.method,
|
||||
});
|
||||
return retryCount < 1;
|
||||
},
|
||||
},
|
||||
userAgent,
|
||||
});
|
||||
|
||||
|
||||
Reference in new issue
Block a user