Skip to content

Commit

Permalink
fix: fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Oct 25, 2022
1 parent 41db9c7 commit 06484b8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion service/events.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ type NodeEvents struct {
}

func (nd *NodeEvents) listenHeadChangesOnce(ctx context.Context) error {
ctx, cancel := context.WithCancel(ctx)
defer cancel()

notifs, err := nd.client.ChainNotify(ctx)
if err != nil {
return err
Expand Down Expand Up @@ -48,7 +51,7 @@ func (nd *NodeEvents) listenHeadChangesOnce(ctx context.Context) error {
}

if err := nd.msgService.ProcessNewHead(ctx, apply); err != nil {
return fmt.Errorf("process new head error: %v", err)
nd.log.Errorf("process new head error: %v", err)
}
}
return nil
Expand Down

0 comments on commit 06484b8

Please # to comment.