-
Notifications
You must be signed in to change notification settings - Fork 259
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
Added support for HTTP 429 Retry-After as per Issue #99 #100
Conversation
This was added in DefaultPolicy and DefaultBackoff. The latter will examine the Retry-After response header (if existant) and do a backoff for the specified amount of time. Otherwise it will default to default backoff behaviour.
There's PR #70 which adds a new retry policy function, based on the one in |
@mariotoffia #70 was merged. Additionally the CLA isn't signed. Please update/fix and we can look again! |
Thanks! :) I've merged and committed - still there's two test errors The report I could download (Artifacts) do not describe the output of the error, just that it has errors on following methods: <testsuites>
<testsuite tests="3" failures="0" time="0.000000" name="github.com/hashicorp/go-retryablehttp">
<properties>
<property name="go.version" value="go1.14.2 linux/amd64"/>
</properties>
<testcase classname="" name="TestMain" time="0.000000">
<failure message="Failed" type="">FAIL github.com/hashicorp/go-retryablehttp 0.007s </failure>
</testcase>
<testcase classname="github.com/hashicorp/go-retryablehttp" name="TestRequest" time="0.000000"/>
<testcase classname="github.com/hashicorp/go-retryablehttp" name="TestFromRequest" time="0.000000"/>
</testsuite>
</testsuites> I don't know why those two functions get's errors since I've not altered those. If I e.g. run TestFromRequest locally it works just fine: go test -v -run TestFromRequest
=== RUN TestFromRequest
--- PASS: TestFromRequest (0.00s)
PASS
ok github.com/hashicorp/go-retryablehttp 0.004s Cheers, |
Seems like he didn't signed the CLA and one test is failing. Any news? |
So @mariotoffia, i am checking your code and already detected the point of panic. |
locally you are testing only TestFromRequest, i did a pure go test before and after your changes and got a [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x6db207] goroutine 9 [running]: When i comment your code at:
every thing runs fine, seems like we have a problem in the header check or in the parsing |
@mateusrangel That's strange - when I do a martoffi@dell:~/progs/github/go-retryablehttp$ go test -v -run TestClient_DefaultBackoff429TooManyRequest I do get === RUN TestClient_DefaultBackoff429TooManyRequest
2020/06/17 21:10:10 [DEBUG] GET http://127.0.0.1:40959
--- PASS: TestClient_DefaultBackoff429TooManyRequest (0.00s)
PASS
ok github.com/hashicorp/go-retryablehttp 0.005s When I run it locally. However, I was a bit curious how to get the test output from your CI tool - how do I do that? Cheers, |
@mateusrangel Ok, I've got it - the resp *http.Response is nil. I'm committing a fix now. |
@mariotoffia Happy to help the debugging 😄 |
@jefferai is it good to go? |
Co-authored-by: Jeff Mitchell <[email protected]>
Co-authored-by: Jeff Mitchell <[email protected]>
Co-authored-by: Jeff Mitchell <[email protected]>
Co-authored-by: Jeff Mitchell <[email protected]>
Co-authored-by: Jeff Mitchell <[email protected]>
Co-authored-by: Jeff Mitchell <[email protected]>
Co-authored-by: Jeff Mitchell <[email protected]>
@jefferai committed your review points - I'd guess this PR needs to be squashed since it is insane amount of commits :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
* Realign behavior of ErrorPropagatedRetryPolicy with DefaultRetryPolicy ErrorPropagatedRetryPolicy should have been modified in #100, but failed to... probably because it has been merged approximately at the same time as #70 (the PR adding ErrorPropagatedRetryPolicy). * Remove code duplication between DefaultRetryPolicy and ErrorPropagatedRetryPolicy
This was added in DefaultPolicy and DefaultBackoff. The latter will
examine the Retry-After response header (if existant) and do a backoff
for the specified amount of time. Otherwise it will default to default
backoff behaviour.
This addresses Issue #99.