Skip to content
This repository has been archived by the owner on May 11, 2024. It is now read-only.

Commit

Permalink
fix(cmd): fix some context close issues (#650)
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp committed Mar 20, 2024
1 parent 13c6ac2 commit f561847
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ func (d *Driver) eventLoop() {

// doSyncWithBackoff performs a synchronising operation with a backoff strategy.
doSyncWithBackoff := func() {
if err := backoff.Retry(d.doSync, backoff.NewConstantBackOff(d.RetryInterval)); err != nil {
if err := backoff.Retry(
d.doSync,
backoff.WithContext(backoff.NewConstantBackOff(d.RetryInterval), d.ctx),
); err != nil {
log.Error("Sync L2 execution engine's block chain error", "error", err)
}
}
Expand Down Expand Up @@ -192,7 +195,7 @@ func (d *Driver) reportProtocolStatus() {
maxNumBlocks = configs.BlockMaxProposals
return nil
},
backoff.NewConstantBackOff(d.RetryInterval),
backoff.WithContext(backoff.NewConstantBackOff(d.RetryInterval), d.ctx),
); err != nil {
log.Error("Failed to get protocol state variables", "error", err)
return
Expand Down
2 changes: 1 addition & 1 deletion pkg/chain_iterator/block_batch_iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ func (i *BlockBatchIterator) Iter() error {
return nil
}

if err := backoff.Retry(iterOp, backoff.NewConstantBackOff(i.retryInterval)); err != nil {
if err := backoff.Retry(iterOp, backoff.WithContext(backoff.NewConstantBackOff(i.retryInterval), i.ctx)); err != nil {
return err
}

Expand Down

0 comments on commit f561847

Please sign in to comment.