Retry-After header missing? #24760
-
If you hit the GitHub API with a lot of requests at once to make PRs etc, you may run in to the API Abuse rate limits. The documentation tells us that:
However, when I run in to these problems I never seem to have that header set:
The I’m calling the API using the Am I missing something at my end, or is this a problem with the GitHub API? Phil |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
Hi there @ewels 👋 Thanks so much for joining us and for sharing your experience. There is additional documentation that speaks to the lack of Best practices for integrators - GitHub Docs//docs.github.com/en/rest/guides/best-practices-for-integrators Specifically:
The behavior you described in your OP:
…is precisely what we try to protect against. As this is an abuse protection measure, it is based on multiple input variables, and there isn’t an X value of seconds to suggest. The process to resolve this would be to decrease the frequency of the scripts calls dramatically, and increase as needed. It looks like the code already has logic to identify an updated frequency value, when that header is present; awesome! Just gotta slow down to start, and everything should behave as you’re hoping. |
Beta Was this translation helpful? Give feedback.
-
Amazing, thank you for the comprehensive answer @nethgato! I’m not quite sure how I missed that, seeing as the bullet is the one below the one I pasted in my original post 🤦♂️ I think I must have missed the critical word not (include…). Anyway, that makes sense and as you say I added a backup approach if the header isn’t there. The context is a sync that runs once every few months but does various repos in parallel so submits 40 odd PRs all at once. How synchronous that is depends on how fast GitHub Actions runs the jobs so the abuse mechanism varies a lot. In the last run it was just one PR, in the one before it was about half. Anyway, my random delay seemed to work on the most recent run so I’m happy 👍 The main thing was that I thought I was going crazy / doing something wrong! So thank you for putting my mind at rest :slight_smile: |
Beta Was this translation helpful? Give feedback.
-
So glad to help! You’re definitely not going crazy and I’m happy I was able to help verify sanity. 🙇 |
Beta Was this translation helpful? Give feedback.
Hi there @ewels 👋
Thanks so much for joining us and for sharing your experience. There is additional documentation that speaks to the lack of
Retry-After
header found here:docs.github.com
Best practices for integrators - GitHub Docs
//docs.github.com/en/rest/guides/best-practices-for-integrators
Specifically:
The behavior you described in your OP:
…i…