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 and Wondertan committed Apr 21, 2024
1 parent 739cbc7 commit 2dbf758
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 @@ -106,7 +106,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 2dbf758

Please sign in to comment.