Uh oh!
There was an error while loading. Please reload this page.
feat: Allow blocking until primary rate limit is reset - #3117
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@## master #3117 +/- ##
==========================================
- Coverage 97.72% 92.87% -4.85%
==========================================
Files 153 170 +17 Lines 13390 11445 -1945 ==========================================
- Hits 13085 10630 -2455 - Misses 215 724 +509 - Partials 90 91 +1 ☔ View full report in Codecov by Sentry. |
Uh oh!
There was an error while loading. Please reload this page.
gmlewis
commented
Apr 1, 2024
It would also be nice to add one or more unit tests that would increase the code coverage for the new code. |
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @erezrokah !
LGTM.
Awaiting second LGTM+Approval from any other contributor to this repo before merging.
erezrokah
commented
Apr 2, 2024
Thanks for the quick review and feedback, I also added a 1 second buffer to the sleep time to avoid any edge cases |
gmlewis
left a comment
There was a problem hiding this comment.
Thanks, @erezrokah .
Still awaiting second LGTM+Approval from any other contributor to this repo before merging.
All contributions, including code reviews, by other volunteers is greatly appreciated, as we have several outstanding PRs that need reviews. Thanks.
erezrokah
commented
Apr 17, 2024
Hi @gmlewis I'm wondering if I should update the PR to take into account context cancellation, by changing timer:=time.NewTimer(time.Until(reset) +buffer)
select {
case<-ctx.Done():
if!timer.Stop() {
<-timer.C
}
returnnil, ctx.Err()
case<-timer.C:
} |
gmlewis
commented
Apr 17, 2024
Ah, that's an excellent idea, @erezrokah - I think you are right that this should be added. |
erezrokah
commented
Apr 18, 2024
Added 22eba4c. In one case I had to wrap the context error in a rate limit error. I can also refactor the code a bit to have |
gmlewis
left a comment
There was a problem hiding this comment.
Just a couple nits, otherwise LGTM.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
Co-authored-by: Glenn Lewis <6598971+gmlewis@users.noreply.github.com>
gmlewis
left a comment
There was a problem hiding this comment.
Thank you, @erezrokah !
LGTM.
gmlewis
commented
May 1, 2024
Thank you, @be0x74a ! |
erezrokah
commented
May 6, 2024
gmlewis
commented
May 6, 2024
gmlewis
commented
May 11, 2024
This is now available here: https://github.com/google/go-github/releases/tag/v62.0.0 |
Fixes#3114
Feedback very much welcomed, some notes:
bypassRateLimitCheckwith the exception thatbypassRateLimitCheckis private, not sure if to use another dedicated exportedrequestContexttype or also makebypassRateLimitCheckpublic for consistencyreq.Context().Value(SleepUntilPrimaryRateLimitResetWhenRateLimited) == trueis also an option (instead of!=nil) and might be more readable, but that is not consistent with thebypassRateLimitCheckcheck