-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix: event handler listen to ctx.Done #38
base: main
Are you sure you want to change the base?
Conversation
f90f747
to
b285804
Compare
b285804
to
399a7e6
Compare
} | ||
} | ||
log.Print("[event handler] stopped work, closing watcher") |
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.
@GoshaDo can explain how the race condition could happen ?
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.
If stop() is called, it will cancel the context (ctx). If the context is already canceled before watcher.Stop() completes, there could be race conditions or unexpected behavior.
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.
see comment
Pull Request
Description
Possible race condition on watcher.Stop() and stop()
Added listen to closure of watcher channel and stop the program
Before submitting this pull request, please ensure that you have completed the following tasks: