Skip to content

Lock aquired when publish an event from subscriber. #52

@BhautikChudasama

Description

@BhautikChudasama

Current behaviour

The main function Publish an event1 and relative handler of event1, publish event2, but the event2 handler is not calling, and the program is not exited.

bus.Subscribe("event2", func() {
	fmt.Println("event2")
})
bus.Subscribe("event1", func(bus EventBus.Bus) {
	fmt.Println("event1")
	time.Sleep(time.Second * 5)
	bus.Publish("event2")
})
bus.Publish("event1", bus)

Further debugging

  • I had seen in subscribe we lock bus, so whenever publish already locked, and in SubscribeAsync we can't lock bus.
    Is that default behaviour?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions