Skip to content

Commit 1bc9bd3

Browse files
committed
fix: do not spend much time re-sending probe tx
1 parent b3dfaab commit 1bc9bd3

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

server/l2.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,6 +727,8 @@ func (l2 *L2) observerProbes(_ context.Context, o otelapi.Observer) error {
727727
func (l2 *L2) sendProbeTx(ctx context.Context) {
728728
l := logutils.LoggerFromContext(ctx)
729729

730+
start := time.Now()
731+
730732
var (
731733
data = make([]byte, 8)
732734
gasPrice *big.Int
@@ -768,6 +770,10 @@ func (l2 *L2) sendProbeTx(ctx context.Context) {
768770

769771
tryingNonces:
770772
for attempt := 1; attempt <= 8; attempt++ { // we don't want to get rate-limited
773+
if attempt > 1 && time.Since(start) > 500*time.Millisecond {
774+
return
775+
}
776+
771777
thisBlock := time.Now().Add(-l2.cfg.BlockTime / 2).Round(l2.cfg.BlockTime)
772778
binary.BigEndian.PutUint64(data, uint64(thisBlock.Unix()))
773779

@@ -863,7 +869,7 @@ func (l2 *L2) checkAndResetProbeTxNonce(ctx context.Context) {
863869
if inFlight > l2.cfg.ProbeTx.ResetThreshold {
864870
l.Warn("In-flight probe transaction count is above threshold, resetting the nonce",
865871
zap.Int64("count", inFlight),
866-
zap.Int64("threshold", l2.monitorProbesLandedCount),
872+
zap.Int64("threshold", l2.cfg.ProbeTx.ResetThreshold),
867873
)
868874

869875
l2.monitorNonce = 0

0 commit comments

Comments
 (0)