This commit is contained in:
Dane Everitt 2020-09-12 20:26:02 -07:00
parent d7fbf29cc1
commit 3ee76ea2bc
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53

View File

@ -47,11 +47,9 @@ func (e *EventBus) Publish(topic string, data string) {
// avoids a panic crash if the process tries to unregister the channel while this routine // avoids a panic crash if the process tries to unregister the channel while this routine
// is running. // is running.
if cp, ok := e.pools[t]; ok { if cp, ok := e.pools[t]; ok {
evt := Event{Data: data, Topic: topic}
for _, callback := range cp.callbacks { for _, callback := range cp.callbacks {
c := *callback c := *callback
evt := evt evt := Event{Data: data, Topic: topic}
// Using the workerpool with one worker allows us to execute events in a FIFO manner. Running // Using the workerpool with one worker allows us to execute events in a FIFO manner. Running
// this using goroutines would cause things such as console output to just output in random order // this using goroutines would cause things such as console output to just output in random order
// if more than one event is fired at the same time. // if more than one event is fired at the same time.