-
Notifications
You must be signed in to change notification settings - Fork 432
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
Fix automatic retries of failed requests #605
Conversation
@ob-stripe You're more familiar with the code here, so will leave to you. It does look like something is off — we increment the number of retries on the first request rather than waiting for an actual retry. The test looks right, but I think it's measuring retries including the original request, which is why it works. |
Ah yeah, looks like I think a slightly better fix would be to keep the comparison as is and move the |
+1. Going off variable names, the code is pretty confusing at right now which is probably how this bug came in in the first place. |
If the number of retries is set to 3, then the total number of requests should be 4: the initial one + the three retries.
This commit modifies `PycurlClient` to set the `should_retry` attribute of `APIConnectionError` exceptions, like `RequestsClient` does.
Done. |
Ping. |
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.
Sorry for the delay @Changaco! Thanks again for the contribution.
Released as 2.35.1. |
Unless I'm missing something, the "less than" comparison here means that the request is retried
n - 1
times instead ofn
times, so settingmax_network_retries
to1
doesn't work and setting it to2
only retries once.