-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
New API to disable retry for an OkHttpClient. #1259
Conversation
Excellent idea and docs. |
Most applications won't want to disable retry globally. Instead, use clone() to get an OkHttpClient for a specific, non-idempotent request, then configure that client with the setting. Closes #1043
162fbfb
to
786e3b3
Compare
New API to disable retry for an OkHttpClient.
yay! Thanks! |
Can I ask a stupid question?
If I send a non-idempotent request to server (like comment in GitHub), and one of those problems above happens. Won't this request handled by server twice (like comment in GitHub twice)? |
If this is set to |
Thank you! |
The "stale pooled connections" case worries me a little bit. See https://code.google.com/p/android/issues/detail?id=61706 for why this will be quite common on linux based OSes. Depending on request patterns, some users might hit this 100% of the time. |
@narayank agreed. Which is why you have to explicitly opt-out of retry. We're also conservative about pooled connections for non-GET requests. |
Why not provide an option for disabling retries based on the potential non-idempotency of the HTTP method itself? I am sure that the overwhelming majority of use-cases for disabling retries are for this. Absent this option, I ended up writing my own delegator class to implement this. Note that while |
|
Most applications won't want to disable retry globally. Instead, use
clone() to get an OkHttpClient for a specific, non-idempotent request,
then configure that client with the setting.
Closes #1043