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 the ability to override the connect and read timeouts #143

Closed
heidiwags opened this issue Apr 24, 2019 · 3 comments
Closed

Allow the ability to override the connect and read timeouts #143

heidiwags opened this issue Apr 24, 2019 · 3 comments

Comments

@heidiwags
Copy link

Currently there is no way to override the read and connect timeout.

I think the builder should be changed to allow passing in a custom configuration, rather than having it default to 300s and 5s.

@davidzhanghp
Copy link
Contributor

Hi @heidiwags. This was fixed as part of #144. Before building the PlaidClient you can get access to the underlying OkHttpClientBuilder and set the timeouts as you wish.

@heidiwags
Copy link
Author

Thanks! Just so that I'm implementing correctly - this is what i have for the sandbox:
PlaidClient.Builder sandboxBuilder = PlaidClient.newBuilder().clientIdAndSecret(clientId, sandboxSecret) .publicKey(publicKey) .sandboxBaseUrl() .logLevel(HttpLoggingInterceptor.Level.BODY); sandboxBuilder.okHttpClientBuilder() .readTimeout(150, TimeUnit.SECONDS) .connectTimeout(3, TimeUnit.SECONDS) ; PlaidClient sandboxPlaidClient = sandboxBuilder.build();

Also - 300s = 5 minutes for the default - are there suggestions for more reasonable read timeouts than 5 minutes? 2.5m still feels long as well - but I'm not sure what the average plaid request takes (we use the API to generate the dwolla token, balance check, generate the access token, and generate the public token

@davidzhanghp
Copy link
Contributor

@heidiwags , the read and connect timeouts are a bit misleading-ly named.
These are socket level timeouts.

The read timeout is the maximum amount of time between successive reads. The connect timeout is similarly a socket-level timeout.

I would set these on the order of seconds, as it limits how long okhttp will wait on socket connect and how long successive reads on the same socket can take to succeed. It does not set a maximum duration for a request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants