-
Notifications
You must be signed in to change notification settings - Fork 234
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
How to set a timeout for GoogleCredentials? #356
Comments
There's also some retry logic baked into the flow that is not configurable: google-auth-library-java/oauth2_http/java/com/google/auth/oauth2/ServiceAccountCredentials.java Lines 404 to 425 in f4f05be
By default failing requests are retried up to 10 times with exponential backoff. |
I agree, there does not seem to be a easy way to do this today. Is your use case you would like to fail faster in your code? Although it is not ideal, I bet you could add timeouts in by wrapping |
Yes, fail fast would be one use case.
Does that imply implementing some sort of a timer around the It appears there's no easy way to implement actual connection/socket timeouts since HTTP request logic is essentially buried in the
|
That method needs to be implemented, its default impl from the base class is to throw an exception. Are you using GoogleCredentials directly or one of the other classes that implement it? I will bring those possible solutions up with my team. Thank you for your input! |
Ours is also a developer product: https://github.com/firebase/firebase-admin-java Developers pass It would be great if there was an API to wrap an existing
But we can also settle for a solution that would require developers to initialize |
@hiranya911 @yoshi-automation Is there an update on this? |
please check merge request |
GoogleCredentials
can be initialized with an optionalHttpTransportFactory
. But this doesn't provide any means of setting the connection and read timeout for the HTTP requests made by the credentials implementation. Is there a way to set these timeout values forGoogleCredentials
?More context: In the Google HTTP client, the recommended way to set timeouts is via an
HttpRequestInitializer
that gets passed into theHttpRequestFactory
.But currently there appears to be no way to specify a request initializer for
GoogleCredentials
. As a result, there's no simple way to configure the timeouts for the HTTP requests made by this implementation.This is a somewhat critical issue, since
GoogleCredentials
get invoked before any other HTTP requests are made by the client. The default timeout settings ofGoogleCredentials
essentially mask and override any timeout values set in the client.In the above example you expect requests to timeout after 10 seconds. But because credentials are in the initializer chain, it won't timeout until 60s (the default).
The text was updated successfully, but these errors were encountered: