Skip to content

Commit

Permalink
fix context
Browse files Browse the repository at this point in the history
  • Loading branch information
boojamya committed Mar 4, 2024
1 parent e0370b4 commit bd66859
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions ethereum/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,13 @@ func (e *Ethereum) WalletBalanceMetric(ctx context.Context, logger log.Logger, m
time.Sleep(time.Duration(queryRate) * time.Second)
firstTime = false
}

// check if context cancelled durint sleep call above
_, isDone := <-ctx.Done()
if isDone {
return
}

if createClient {
client, err = ethclient.DialContext(ctx, e.rpcURL)
if err != nil {
Expand Down

0 comments on commit bd66859

Please sign in to comment.