Skip to content

Commit 2003fb6

Browse files
committed
ethmonitor: fix goroutine leak
1 parent 9f78a00 commit 2003fb6

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎ethmonitor/ethmonitor.go‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1023,7 +1023,10 @@ func (m *Monitor) publish(ctx context.Context, events Blocks) error {
10231023
// Publish events existing in the queue
10241024
pubEvents, ok := m.publishQueue.dequeue(maxBlockNum)
10251025
if ok {
1026-
m.publishCh <- pubEvents
1026+
select {
1027+
case m.publishCh <- pubEvents:
1028+
case <-m.ctx.Done():
1029+
}
10271030
}
10281031

10291032
return nil

0 commit comments

Comments
 (0)