-
Notifications
You must be signed in to change notification settings - Fork 389
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
adding user configurable read timeouts #901
Conversation
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.
we can only need Timeout
stored in either Config
or Profile
(Profile
is already a field in Config
). Config
makes more sense imo, since Profile
is more user account related values.
what we need is something like
func (c *Config) GetTimeout() int64 {
// return customized timeout or default timeout
}
gotcha, made that change! I still kept the get function in |
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.
ohh now i see why you tried to add timeout
to profile. if you want to follow the way color
is set on profile
, lets keep everything consistent.
- we dont need
Config.GetTimeout
. we can just keepProfile.GetTimeout
(sorry for the confusion earlier), buttimeout
field should still live only on config struct like howcolor
does. - we dont need
timeout
added toproxy.Config
. we can passprofile.GetTimeout
to theHttpClient
- add
timeout
flag to rootcmd. see example here: https://github.com/stripe/stripe-cli/blob/master/pkg/cmd/root.go#L141
pkg/cmd/playback.go
Outdated
@@ -263,6 +263,7 @@ func runListen(cmd *cobra.Command, address string, wg *sync.WaitGroup) error { | |||
SkipVerify: false, | |||
Log: logger, | |||
NoWSS: false, | |||
Timeout: 30, |
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.
doesn't seem like there's a need to add the private flag to here actually? it seems like there's only one call to proxy.init
and most parameters are getting passed default values
@@ -102,6 +102,8 @@ type Config struct { | |||
Log *log.Logger | |||
// Force use of unencrypted ws:// protocol instead of wss:// | |||
NoWSS bool | |||
// Override default timeout | |||
Timeout int64 |
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.
could you please explain why we need to pass this in proxy.config?
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.
ah, i was thinking it would be more consistent with how the other hidden flags' values are passed (like noWSS and apiBaseUrl are passed this way into proxy as well).
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 making all the changes!
Reviewers
r? @etsai-stripe
cc @stripe/developer-products
Summary
Allows user to set timeout in config file using a hidden flag (ex. stripe listen --timeout xx); if not set, defaults to 30 seconds as it was before.