File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { RequestError } from '@octokit/request-error'
2-
31const DEFAULT_SLEEPTIME = parseInt ( process . env . SECONDARY_RATELIMIT_RETRY_SLEEPTIME || '30000' , 10 )
42const DEFAULT_ATTEMPTS = parseInt ( process . env . SECONDARY_RATELIMIT_RETRY_ATTEMPTS || '5' , 10 )
53
@@ -16,9 +14,14 @@ export async function octoSecondaryRatelimitRetry<T>(
1614 try {
1715 return await fn ( )
1816 } catch ( error ) {
17+ // Use duck-typing instead of `instanceof RequestError` because octokit
18+ // bundles its own copy of @octokit /request-error in dist-bundle/index.js,
19+ // so the class reference differs from the top-level package and instanceof
20+ // always returns false across the module boundary.
1921 if (
20- error instanceof RequestError &&
21- error . status === 403 &&
22+ error instanceof Error &&
23+ 'status' in error &&
24+ ( error as { status : number } ) . status === 403 &&
2225 / Y o u h a v e e x c e e d e d a s e c o n d a r y r a t e l i m i t / . test ( error . message )
2326 ) {
2427 if ( tries < attempts ) {
You can’t perform that action at this time.
0 commit comments