create-pull-request
create-pull-request copied to clipboard
Display Retry-After when hitting rate limits
Subject of the issue
#855 explains that it is hard to handle situations where one would hit
You have exceeded a secondary rate limit and have been temporarily blocked from content creation. Please retry your request again later. and I agree with the result of the discussion.
But what would be really nice to have is a printout of the received Retry-After header content in the log message.
For now I will have to retry after a random time potentially hitting the same rate limits again and again. And additional display of the received header would make sure that I won't try before backoff period really expired.
Hi @kwavnet
I'm not sure how easy it would be for me to extract that information. I'm using Octokit to handle API requests, so it depends if I can tap into that information somehow. I'll try to check if it's possible.
I'm also not sure if there even is a Retry-After header when hitting secondary rate limits. I would not be surprised if there isn't, because they want clients to back-off for a long time before retrying. Retry-After is normally used for scenarios where they just want you to slow down by seconds.
From what I see there is https://github.com/octokit/octokit.js/blob/55564cd3f7c0f6d429852e8dddf5dc01e6294f80/src/octokit.ts#L36 - giving the needed information - not sure if that can be overridden by a custom handler