EventDeduplicator must close its own channel#2488
Conversation
…ine to avoid race conditions
c-kruse
left a comment
There was a problem hiding this comment.
I think that this introduces a different chance for a panic: QueueEvent after Stop tries to send on a closed eventCh channel.
Rather than trying to guard QueueEvent or something, I think we'd be better off with a new done channel owned by the EventDeduplicator to clean up goroutine(s) when Stop() is called instead of giving eventCh a second purpose.
As an aside, I'm not sure there's much reason to split out a new goroutine to listen for stopCh. It may end up cleaner to keep everything in processEvents.
|
@c-kruse I see your point. Regarding what you have said here
The reason of the splitting was that during testing, after queuing a new event and stopping the channel, proccesEvents was choosing randomly to process the event rather than stopping its channel most of the time. I will try what you have suggested. |
Fixes #2485