diff --git a/driver/driver.go b/driver/driver.go index 36b1d1ca8..07f728512 100644 --- a/driver/driver.go +++ b/driver/driver.go @@ -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) } } @@ -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 diff --git a/pkg/chain_iterator/block_batch_iterator.go b/pkg/chain_iterator/block_batch_iterator.go index 72cccf169..e33c09393 100644 --- a/pkg/chain_iterator/block_batch_iterator.go +++ b/pkg/chain_iterator/block_batch_iterator.go @@ -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 }