diff options
author | Valery Piashchynski <[email protected]> | 2021-06-08 12:20:50 +0300 |
---|---|---|
committer | Valery Piashchynski <[email protected]> | 2021-06-08 12:20:50 +0300 |
commit | d9081fceace70911a0ad8fe7bca46fc44231ecd3 (patch) | |
tree | c6ecace041bdb70754825123c60d78cd43d84dd8 /pkg | |
parent | 20da67889c6743d0d7efc5027372331145d57d96 (diff) |
- Make listener push async in the worker_handler
Signed-off-by: Valery Piashchynski <[email protected]>
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/worker_handler/handler.go | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/pkg/worker_handler/handler.go b/pkg/worker_handler/handler.go index 2534a331..fc03563b 100644 --- a/pkg/worker_handler/handler.go +++ b/pkg/worker_handler/handler.go @@ -192,8 +192,13 @@ func (h *Handler) handleResponse(req *Request, resp *Response, start time.Time) // sendEvent invokes event handler if any. func (h *Handler) sendEvent(event interface{}) { if h.lsn != nil { - for _, l := range h.lsn { - l(event) + for i := range h.lsn { + // do not block the pipeline + // TODO not a good approach, redesign event bus + i := i + go func() { + h.lsn[i](event) + }() } } } |