mirror of
https://github.com/werbenhu/eventbus.git
synced 2025-09-26 20:41:48 +08:00
Merge pull request #11 from riptideslabs/multi-loop-fix
Remove second goroutine for channel loop in Publish and PublishSync methods
This commit is contained in:
@@ -209,7 +209,6 @@ func (e *EventBus) Publish(topic string, payload any) error {
|
||||
if !ok {
|
||||
ch = newChannel(topic, e.bufferSize)
|
||||
e.channels.Store(topic, ch)
|
||||
go ch.(*channel).loop()
|
||||
}
|
||||
|
||||
return ch.(*channel).publish(payload)
|
||||
@@ -224,7 +223,6 @@ func (e *EventBus) PublishSync(topic string, payload any) error {
|
||||
if !ok {
|
||||
ch = newChannel(topic, e.bufferSize)
|
||||
e.channels.Store(topic, ch)
|
||||
go ch.(*channel).loop()
|
||||
}
|
||||
|
||||
return ch.(*channel).publishSync(payload)
|
||||
|
Reference in New Issue
Block a user