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

Ensure to close StreamFrame channel #12248

Merged
merged 2 commits into from
Mar 28, 2022
Merged

Conversation

nakabonne
Copy link
Contributor

@nakabonne nakabonne commented Mar 9, 2022

A tiny fix to close the StreamFream channel before finishing the streaming by the <-cancel channel.

Let's say you use FrameReader.Read(), now we have no way to quit the select block even when the streaming finished. (Actually we can pass cancelCh chan struct{} to NewFrameReader but I'd like to stop reading when <-ctx.Done())

Therefore, I would say it should close immediately as soon as the streaming finished.

@hashicorp-cla
Copy link

hashicorp-cla commented Mar 9, 2022

CLA assistant check
All committers have signed the CLA.

@nakabonne
Copy link
Contributor Author

Should I do anything else to make the CI successful? Please tell me if there is, thank you.

@tgross tgross self-assigned this Mar 28, 2022
Copy link
Member

@tgross tgross left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @nakabonne! Sorry for the delay in reviewing this. I'm looking at the only call site we currently have for this function in Nomad (ref api/fs.go#L341-L357) and it looks like the results end up being the same either way in our current implementation. But this change probably makes it more clear for callers, so LGTM.

I'm not worried about the CI we see failing here, as those are for docs and need approval to run anyways. But for some reason none of the unit tests ran for this PR and I'm not sure why. I'm going to try to rebase this PR on main and see if I can get the build to kick off.

@tgross tgross moved this from Needs Triage to In Progress in Nomad - Community Issues Triage Mar 28, 2022
@tgross tgross merged commit 97dc687 into hashicorp:main Mar 28, 2022
Nomad - Community Issues Triage automation moved this from In Progress to Done Mar 28, 2022
@tgross
Copy link
Member

tgross commented Mar 28, 2022

Tests are green, so LGTM! Thanks @nakabonne!

@tgross tgross added this to the 1.3.0 milestone Mar 28, 2022
@nakabonne
Copy link
Contributor Author

@tgross Thank you for maintaining this great project!

@nakabonne nakabonne deleted the close-channel branch March 29, 2022 02:18
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active contributions.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 24, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

3 participants