From 1c1b5043fcdc66339b4007174d99405fa68adda5 Mon Sep 17 00:00:00 2001 From: Pavel Karpy Date: Wed, 3 Aug 2022 19:33:40 +0300 Subject: [PATCH] [#1653] morph: Handle chain notifications via pool Handling notification in a synchronous manner may lead to a blocking state if a handler uses neo-go client. Signed-off-by: Pavel Karpy --- pkg/morph/event/listener.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pkg/morph/event/listener.go b/pkg/morph/event/listener.go index a210fd85f..af6ed3049 100644 --- a/pkg/morph/event/listener.go +++ b/pkg/morph/event/listener.go @@ -250,7 +250,12 @@ loop: continue loop } - l.parseAndHandleNotification(notifyEvent) + if err = l.pool.Submit(func() { + l.parseAndHandleNotification(notifyEvent) + }); err != nil { + l.log.Warn("listener worker pool drained", + zap.Int("capacity", l.pool.Cap())) + } case notaryEvent, ok := <-notaryChan: if !ok { l.log.Warn("stop event listener by notary channel")