Skip to content
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

Merged
merged 3 commits into from
Nov 22, 2023

Conversation

eduardodbr
Copy link
Contributor

fixed #2249

@eduardodbr eduardodbr requested a review from Jeffail as a code owner November 20, 2023 20:13
@eduardodbr eduardodbr changed the title Read until idle timeout Feat: add idle_timeout to read_until Nov 20, 2023

if check == nil {
return nil, errors.New("a check query is required")
if check == nil && idleTimeout < 0 {
Copy link
Collaborator

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.

Copy link
Contributor Author

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

Copy link
Collaborator

@Jeffail Jeffail left a 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.

@Jeffail Jeffail merged commit 24c6ec4 into redpanda-data:main Nov 22, 2023
3 checks passed
@mihaitodor
Copy link
Collaborator

Nice catch @Jeffail! I think that timer enhancement is still WIP: golang/go#61542

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update read_until to close the input after an idle timeout
3 participants