-
Notifications
You must be signed in to change notification settings - Fork 733
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve wait handing in abuse retry #1971
Conversation
Oh gosh, I thought reset my branch to the latest upstream before starting work, but apparently I reset to some other entirely different branch instead. Will sort it out. |
25eee97
to
218d4f1
Compare
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1971 +/- ##
=========================================
Coverage 83.08% 83.09%
- Complexity 2328 2329 +1
=========================================
Files 231 231
Lines 7164 7168 +4
Branches 376 377 +1
=========================================
+ Hits 5952 5956 +4
Misses 974 974
Partials 238 238 ☔ View full report in Codecov by Sentry. |
The code coverage report is interesting. My code handles the case where the "Date" field isn't set, even though all the example responses from GitHub do include this header. I could fix the coverage warning by removing the guard, and assuming that "Date" is always present – but I don't think that would improve the code quality. :) I could also fix the warning by adding a test for that scenario, but I'm not sure it's the best use of time, since it's an unlikely scenario which the code already guards against. What do you think, @bitwiseman? |
I'm not convinced it's adding value, since it's trivial code and an unlikely scenario, but I've added the test for the "missing date header" case. :) |
f6756af
to
a7db9fd
Compare
34adf7d
to
8141cb1
Compare
8141cb1
to
b22f346
Compare
Sorry, I thought I'd responded to say that a missing |
Fixes #1909.
While I was looking at #1909, I noticed that this code in my earlier PR is a bit hard to follow:
I think it might have been copied from [this line] (https://github.com/hub4j/github-api/blame/768c7154bdb84e775dfafea6b0cb27fa57d835c7/src/main/java/org/kohsuke/github/GitHubRateLimitHandler.java#L80) in
GitHubRateLimitHandler
:That second piece of code also uses
System.currentTimeMillis()
, which as pointed out in #1909 may not be accurate. The class was changed in a reformat, but apart from that hasn’t been changed for a while, so I think the problem is an old one. I didn't touch that class in this change, but we should go back and update it too.So this is what I’ve done:
Math.min()
to both paths (number and date)