-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Make the default timout 5 minutes when timeout is 0 #1056
Merged
modular-magician
merged 4 commits into
GoogleCloudPlatform:master
from
chrisst:default-timeouts
Dec 17, 2018
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
857cc48
Make the default timout 5 minutes when timeout is 0
chrisst f715ab6
change sendRequest to use 5 min default
chrisst d43ff27
changing default timeout to something big
chrisst cb0a212
Update tracked submodules -> HEAD on Mon Dec 17 20:55:44 UTC 2018
modular-magician File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Submodule terraform
updated
from edcbd7 to 362206
Submodule terraform-beta
updated
from 5b5c78 to 881cd1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why not just have
sendRequest
send 5 instead of 0?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 had considered that, but if somebody called sendRequestWithTimeout and passed in a 0 timeout (the nil value for timeout) then it will timeout immediately which doesn't feel like a good behavior for handling a nil value. I would have preferred if a nil value caused there to be no timeout at all but that would have made the method a bit more complex so I took this middle route.
I don't feel super strongly about any of the options so let me know if you have a preference.
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.
Drive-by but personally I would prefer passing in the default value in
sendRequest
instead of replacing actual timeout values of 0 with that defaultThere 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.
Out of curiosity, what's your opinion on expected behavior when passing in a nil value into the callWithTimeout method?
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.
Either an explicit error or something terrible happening! I could also see one of
0
ornil
meaning no timeout at all iftime.Duration
doesn't express that in another way.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.
wouldn't that be a compile-time error?
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.
Passing actual nil would be compile time, but it's recommended that you code should handle zero value inputs in a responsible manner. So I would think that if you passed in a zero value for a timeout that the code would handle it with no timeout, since a timeout of 0 isn't really a thing.
Kind of like how methods that are on pointer receivers shouldn't throw errors or panic when called with a nil receiver.
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.
That makes sense. I don't think there's a way to do infinity, but you can certainly just do a very large number.