[#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 <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2022-08-03 19:33:40 +03:00 committed by LeL
parent 8f44335925
commit 1c1b5043fc

View file

@ -250,7 +250,12 @@ loop:
continue loop continue loop
} }
if err = l.pool.Submit(func() {
l.parseAndHandleNotification(notifyEvent) l.parseAndHandleNotification(notifyEvent)
}); err != nil {
l.log.Warn("listener worker pool drained",
zap.Int("capacity", l.pool.Cap()))
}
case notaryEvent, ok := <-notaryChan: case notaryEvent, ok := <-notaryChan:
if !ok { if !ok {
l.log.Warn("stop event listener by notary channel") l.log.Warn("stop event listener by notary channel")