-
Notifications
You must be signed in to change notification settings - Fork 141
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
Allow to override default timeouts for Http Client #206
Conversation
@@ -58,6 +63,12 @@ private void enableLogging(OkHttpClient client) { | |||
client.interceptors().add(interceptor); | |||
} | |||
|
|||
private void setTimeout(OkHttpClient client, int timeout){ | |||
client.setConnectTimeout(timeout, TimeUnit.SECONDS); | |||
client.setReadTimeout(timeout, TimeUnit.SECONDS); |
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.
I believe it should only allow to change the "connect timeout" value, that would mean the time it takes for the server to acknowledge our request. The other 2 could extend the total request time far more than necessary. What's the justification to change the others?
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.
You are correct this was improperly implemented. It should give the user the ability to update each timeout individually. For our purposes when I made the change having all timeouts set to the same value was good enough.
I updated the code to allow setting each timeout individually.
auth0/src/test/java/com/auth0/android/request/internal/OkHttpClientFactoryTest.java
Outdated
Show resolved
Hide resolved
auth0/src/test/java/com/auth0/android/request/internal/OkHttpClientFactoryTest.java
Outdated
Show resolved
Hide resolved
auth0/src/test/java/com/auth0/android/request/internal/OkHttpClientFactoryTest.java
Outdated
Show resolved
Hide resolved
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.
Thanks!! 💯
Adding the ability to optionally override the default 10 second timeout of the OkHttpClient