File tree 1 file changed +9
-6
lines changed 1 file changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -165,18 +165,21 @@ const _mineTransaction = async (
165
165
}
166
166
167
167
// Else the transaction is not mined yet.
168
- const ellapsedMs = Date . now ( ) - sentTransaction . queuedAt . getTime ( ) ;
168
+ const elapsedSeconds = msSince ( sentTransaction . sentAt ) / 1000 ;
169
169
job . log (
170
- `Transaction is not mined yet. Check again later. elapsed=${ ellapsedMs / 1000 } s` ,
170
+ `Transaction is not mined yet. Check again later. elapsed=${ elapsedSeconds } s` ,
171
171
) ;
172
172
173
- // Resend the transaction (after some initial delay) .
173
+ // Resend the transaction if `minEllapsedBlocksBeforeRetry` blocks or 120 seconds have passed since the last send attempt .
174
174
const config = await getConfig ( ) ;
175
175
const blockNumber = await getBlockNumberish ( sentTransaction . chainId ) ;
176
- const ellapsedBlocks = blockNumber - sentTransaction . sentAtBlock ;
177
- if ( ellapsedBlocks >= config . minEllapsedBlocksBeforeRetry ) {
176
+ const elapsedBlocks = blockNumber - sentTransaction . sentAtBlock ;
177
+ const shouldResend =
178
+ elapsedBlocks >= config . minEllapsedBlocksBeforeRetry ||
179
+ elapsedSeconds > 120 ;
180
+ if ( shouldResend ) {
178
181
job . log (
179
- `Resending transaction after ${ ellapsedBlocks } blocks. blockNumber=${ blockNumber } sentAtBlock=${ sentTransaction . sentAtBlock } ` ,
182
+ `Resending transaction after ${ elapsedBlocks } blocks. blockNumber=${ blockNumber } sentAtBlock=${ sentTransaction . sentAtBlock } ` ,
180
183
) ;
181
184
await SendTransactionQueue . add ( {
182
185
queueId : sentTransaction . queueId ,
You can’t perform that action at this time.
0 commit comments