Skip to content

Commit

Permalink
fix: also retry secondary rate limits (#798)
Browse files Browse the repository at this point in the history
## What
Enable retries for secondary rate limits.

## Why
The pipeline to fetch data fails due to secondary rate limits.

## References
-
https://github.com/npm/statusboard/actions/runs/8264295320/job/22607600796#step:8:5732
  • Loading branch information
jumoel authored Mar 13, 2024
1 parent 001e42e commit ca53c56
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion workspaces/data/lib/api/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,16 @@ module.exports = ({ auth }) => {
return true
}
},
onSecondaryRateLimit: (__, options, octokit) => {
onSecondaryRateLimit: (retryAfter, options, octokit) => {
octokit.log.warn(
`SecondaryRateLimit detected for request ${options.method} ${options.url}`
)

if (options.request.retryCount === 0) {
// only retries once
octokit.log.info(`Retrying after ${retryAfter} seconds!`)
return true
}
},
},
})
Expand Down

0 comments on commit ca53c56

Please sign in to comment.