square / okhttp

Square’s meticulous HTTP client for the JVM, Android, and GraalVM.
https://square.github.io/okhttp/
Apache License 2.0
45.89k stars 9.16k forks source link

Exponential Backoff support #2489

Closed juanpmarin closed 8 years ago

juanpmarin commented 8 years ago

The Google's Http Client has an implementation of this algorithm which essentially improves the way retrying a request in case of failures. Is it possible to make yours ?

Additional info: https://developers.google.com/api-client-library/java/google-http-java-client/backoff

wingsum93 commented 8 years ago

-1 , if it is user trigger, no data = no retry. because server may return 500.

if you send data in background, you may retry yourself in own way.

swankjesse commented 8 years ago

I’d like to leave this up to the application layer. Backoffs might need to be scheduled in another process if a server is redeployed or an app is relaunched. It’s really awkward to hide the response indefinitely.