Skip to content

Commit

Permalink
[#1653] morph: Handle chain notifications via pool
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
carpawell authored and cthulhu-rider committed Aug 4, 2022
1 parent 8f44335 commit 1c1b504
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/morph/event/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 1c1b504

Please sign in to comment.