From bc1b6a6c54b8f519a603fad11a3f6a760bbf8674 Mon Sep 17 00:00:00 2001 From: Steven Berlanga Date: Sat, 5 Mar 2016 18:31:20 -0500 Subject: [PATCH] making sure that listeners are notified on their own go routine to not block the sender --- exchange/exchange.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/exchange/exchange.go b/exchange/exchange.go index 1854e55..7ba759d 100644 --- a/exchange/exchange.go +++ b/exchange/exchange.go @@ -29,7 +29,7 @@ func (ex *Exchange) Listen(event string, fn func(interface{})) { func (ex *Exchange) Send(event string, data interface{}) { ex.mtx.RLock() for _, fn := range ex.queues[event] { - fn(data) + go fn(data) } ex.mtx.RUnlock() }