Skip to content

Commit

Permalink
fix(core): Unsubscribe from new block event on Stop in listener (#3315)
Browse files Browse the repository at this point in the history
Subscription was never cancelled on Stop, found while working on swamp
tests for #3188
  • Loading branch information
renaynay authored Apr 18, 2024
1 parent 29678cb commit 500116d
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion core/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ func (cl *Listener) Start(context.Context) error {
}

// Stop stops the listener loop.
func (cl *Listener) Stop(context.Context) error {
func (cl *Listener) Stop(ctx context.Context) error {
err := cl.fetcher.UnsubscribeNewBlockEvent(ctx)
if err != nil {
log.Warnw("listener: unsubscribing from new block event", "err", err)
}

cl.cancel()
cl.cancel = nil
return cl.metrics.Close()
Expand Down

0 comments on commit 500116d

Please sign in to comment.