Skip to content

close event channel on shutdown - #34

Open
zeidlermicha wants to merge 1 commit into
zach-klippenstein:masterfrom
zeidlermicha:patch-1
Open

close event channel on shutdown#34
zeidlermicha wants to merge 1 commit into
zach-klippenstein:masterfrom
zeidlermicha:patch-1

Conversation

@zeidlermicha

Copy link
Copy Markdown

this will help jumping out of the for loop:
for event := range watcher.C()

@tslocum

tslocum commented Dec 9, 2020

Copy link
Copy Markdown

Simply closing the channel isn't quite right. Without handling this closure in the goroutines holding a reference to the channel, the application will panic when they attempt to send an event through the closed channel. Example:

eventChan <- event

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.

2 participants