Skip to content
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

Merged
merged 5 commits into from
Dec 3, 2018

Conversation

nolivermke
Copy link
Contributor

Adding the ability to optionally override the default 10 second timeout of the OkHttpClient

@@ -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);
Copy link
Contributor

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?

Copy link
Contributor Author

@nolivermke nolivermke Dec 3, 2018

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.

Copy link
Contributor

@lbalmaceda lbalmaceda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!! 💯

@lbalmaceda lbalmaceda added this to the v1-Next milestone Dec 3, 2018
@lbalmaceda lbalmaceda changed the title Added ability to override default timeouts for OkHttpClient Allow to override default timeouts for Http Client Dec 3, 2018
@lbalmaceda lbalmaceda merged commit 34bc106 into auth0:master Dec 3, 2018
@lbalmaceda lbalmaceda modified the milestones: v1-Next, 1.15.0 Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants