fix(releases): return true from rate limit handlers to enable retry

The octokit throttling plugin uses the return value of onRateLimit and
onSecondaryRateLimit to decide whether to retry. Without returning true,
rate-limited requests fail instead of being retried.

Bounded to 1 retry (retryCount < 1) to prevent infinite retry loops.

Addresses CodeRabbit review feedback.
This commit is contained in:
ajnart committed 2026-07-14 20:17:19 +02:00
1 parent c01fd723ee
commit aaff62fff2
1 file changed
+6 -4
@@ -136,17 +136,19 @@ const getGithubApi = (baseUrl: string, userAgent: string, token?: string) =>
request: { fetch: fetchWithTrustedCertificatesAsync },
throttle: {
enabled: true,
onRateLimit: (retryAfter: number, options: { url?: string; method?: string }) => {
logger.warn(`GitHub rate limit exceeded, retrying after ${retryAfter}s`, {
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 }) => {
logger.warn(`GitHub secondary rate limit exceeded, retrying after ${retryAfter}s`, {
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,