-
Notifications
You must be signed in to change notification settings - Fork 578
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
Implement settable timeouts in Functions. #224
Conversation
bklimt
commented
Jan 30, 2019
- Update okhttp to a newer version.
- Change the default timeout for Functions to 60 seconds, to match the backend.
- Add methods to change the timeout for a Function.
- Ensure all exceptions coming from Functions are wrapped in FirebaseFunctionsException.
/retest |
1 similar comment
/retest |
These oss-bot failures don't look like they have anything to do with my changes. |
/retest |
This was implemented with okhttp 3, because the newer version: 1) lets us specify a single timeout for the whole call, instead of separate timeouts for connect, read, and write, and 2) lets us easily set timeouts for particular calls, rather than having to create a new client for each callable. https://github.com/square/okhttp/wiki/Recipes#timeouts The downside is this may increase library size for developers using both Firestore and Functions, since they will no longer share the same okhttp version. |
Is 60s the best number on the client? If that's measured by the moment the client attempts to connect, to the moment it receives the response, the function on the server may not actually have its own full 60s to yield a response, since the client could also be waiting for network latency and such. |
60s is what had been agreed upon for the API, and it's a big improvement over the previous, unspecified default. But I agree it would be reasonable to have a longer default to account for connection time. We should make the default the same across all client SDKs. What length default timeout would you propose? |
I'd guess that a buffer of 5 extra seconds is enough to cover 98% of the connections out there. |
After some discussion offline, I've upped the default timeout to 70s. Thanks for the feedback @CodingDoug. |
/retest |
@bklimt: The following test failed, say
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
firebase-functions/src/main/java/com/google/firebase/functions/HttpsCallOptions.java
Show resolved
Hide resolved
* @param timeout The length of the timeout, in the given units. | ||
* @param units The units for the specified timeout. | ||
*/ | ||
public void setTimeout(long timeout, TimeUnit units) { |
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.
Does this require an API review?
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.
Yes, the API has been approved. go/callable-timeouts
firebase-functions/src/main/java/com/google/firebase/functions/FirebaseFunctions.java
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 for your patience