Skip to content

Commit

Permalink
address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
poopoothegorilla committed Jan 24, 2024
1 parent 55d9ace commit 676b07c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion common/txmgr/strategies.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (s DropOldestStrategy) PruneQueue(ctx context.Context, pruneService txmgrty
ctx, cancel = context.WithTimeout(ctx, s.queryTimeout)
defer cancel()

// NOTE: We prune one less than the queue size because we will be adding a new transaction to the queue right after this PruneQueue call
// NOTE: We prune one less than the queue size to prevent the queue from exceeding the max queue size. Which could occur if a new transaction is added to the queue right after we prune.
ids, err = pruneService.PruneUnstartedTxQueue(ctx, s.queueSize-1, s.subject)
if err != nil {
return ids, fmt.Errorf("DropOldestStrategy#PruneQueue failed: %w", err)
Expand Down
6 changes: 3 additions & 3 deletions common/txmgr/txmgr.go
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) CreateTran
return tx, fmt.Errorf("Txm#CreateTransaction: %w", err)
}

tx, err = b.createTxnAndPruneQueue(ctx, txRequest, b.chainID)
tx, err = b.pruneQueueAndCreateTxn(ctx, txRequest, b.chainID)
if err != nil {
return tx, err
}
Expand Down Expand Up @@ -562,7 +562,7 @@ func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) SendNative
FeeLimit: gasLimit,
Strategy: NewSendEveryStrategy(),
}
etx, err = b.createTxnAndPruneQueue(ctx, txRequest, chainID)
etx, err = b.pruneQueueAndCreateTxn(ctx, txRequest, chainID)
if err != nil {
return etx, fmt.Errorf("SendNativeToken failed to insert tx: %w", err)
}
Expand Down Expand Up @@ -683,7 +683,7 @@ func (n *NullTxManager[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, SEQ, FEE]) Cou
return count, errors.New(n.ErrMsg)
}

func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) createTxnAndPruneQueue(
func (b *Txm[CHAIN_ID, HEAD, ADDR, TX_HASH, BLOCK_HASH, R, SEQ, FEE]) pruneQueueAndCreateTxn(
ctx context.Context,
txRequest txmgrtypes.TxRequest[ADDR, TX_HASH],
chainID CHAIN_ID,
Expand Down

0 comments on commit 676b07c

Please sign in to comment.