-
Notifications
You must be signed in to change notification settings - Fork 847
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
Feat: add idle_timeout to read_until #2263
Feat: add idle_timeout to read_until #2263
Conversation
Signed-off-by: eduardodbr <[email protected]>
Signed-off-by: eduardodbr <[email protected]>
Signed-off-by: eduardodbr <[email protected]>
|
||
if check == nil { | ||
return nil, errors.New("a check query is required") | ||
if check == nil && idleTimeout < 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.
Wouldn't it be better to have <= 0
and initialise idleTimeout
to 0
instead of -1
? Not sure if 0
duration makes sense here.
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 also works. At first, my goal was to set it as negative to disable it, but I later realized that I didn't need to do that because we can use the empty string as a default value, so I guess I just forgot to change it to 0 since it still works like this. I'll update it, thanks
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.
LGTM, thanks @eduardodbr. One minor concern is whether there's a significant hit to having unbounded timers allocated from a busy input. Normally I'd rework this to use time.NewTimer
which we can stop but I also remember reading about an optimisation in Go where that's no longer necessary, I can't find it right now though so maybe I dreamt it. I might rework it just incase.
Nice catch @Jeffail! I think that timer enhancement is still WIP: golang/go#61542 |
fixed #2249