When a Post is made for an event, a for-loop is used to broadcast the event to all the channel registered to that event.
But the send down the goroutine is a blocking call, and the channels are non-buffered, so it may block indefinately trying to send to the first channel, even though there are others also registered on that channel.
Basically all code that looks like this:
for _, outputChan := range outChans {
outputChan <- data
}
Should look like this
for _, outputChan := range outChans {
go outputChan <- data
}
PS. I know this repo hasnt been updated in 2 years, but this was a concern of mine while using it. I'm happy to submit a pull request if I know it'll get merged in.
When a
Post
is made for an event, a for-loop is used to broadcast the event to all the channel registered to that event.But the send down the goroutine is a blocking call, and the channels are non-buffered, so it may block indefinately trying to send to the first channel, even though there are others also registered on that channel.
Basically all code that looks like this:
Should look like this
PS. I know this repo hasnt been updated in 2 years, but this was a concern of mine while using it. I'm happy to submit a pull request if I know it'll get merged in.