Skip to content

Commit

Permalink
updating runLoop in resender to use internal context
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhuie19 committed Feb 22, 2024
1 parent 460958c commit 2dfda6b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions common/txmgr/resender.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func NewResender[
// Start is a comment which satisfies the linter
func (er *Resender[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Start(ctx context.Context) {
er.logger.Debugf("Enabled with poll interval of %s and age threshold of %s", er.interval, er.txConfig.ResendAfterThreshold())
go er.runLoop(er.ctx)
go er.runLoop()
}

// Stop is a comment which satisfies the linter
Expand All @@ -113,10 +113,10 @@ func (er *Resender[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) Stop() {
<-er.chDone
}

func (er *Resender[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) runLoop(ctx context.Context) {
func (er *Resender[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) runLoop() {
defer close(er.chDone)

if err := er.resendUnconfirmed(ctx); err != nil {
if err := er.resendUnconfirmed(er.ctx); err != nil {
er.logger.Warnw("Failed to resend unconfirmed transactions", "err", err)
}

Expand All @@ -127,7 +127,7 @@ func (er *Resender[CHAIN_ID, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) runLoop(ct
case <-er.ctx.Done():
return
case <-ticker.C:
if err := er.resendUnconfirmed(ctx); err != nil {
if err := er.resendUnconfirmed(er.ctx); err != nil {
er.logger.Warnw("Failed to resend unconfirmed transactions", "err", err)
}
}
Expand Down

0 comments on commit 2dfda6b

Please sign in to comment.