From 601c6fe73ed7a610edefe82f337fe6169ef4cfb6 Mon Sep 17 00:00:00 2001 From: Alexey Shekhirin Date: Thu, 3 Oct 2024 15:10:08 +0300 Subject: [PATCH] fix(exex): limit the duration of a backfill job to 30 seconds (#11450) --- crates/exex/exex/src/backfill/factory.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/exex/exex/src/backfill/factory.rs b/crates/exex/exex/src/backfill/factory.rs index c210eda477..026df98227 100644 --- a/crates/exex/exex/src/backfill/factory.rs +++ b/crates/exex/exex/src/backfill/factory.rs @@ -1,5 +1,5 @@ use crate::BackfillJob; -use std::ops::RangeInclusive; +use std::{ops::RangeInclusive, time::Duration}; use alloy_primitives::BlockNumber; use reth_node_api::FullNodeComponents; @@ -25,7 +25,15 @@ impl BackfillJobFactory { executor, provider, prune_modes: PruneModes::none(), - thresholds: ExecutionStageThresholds::default(), + thresholds: ExecutionStageThresholds { + // Default duration for a database transaction to be considered long-lived is + // 60 seconds, so we limit the backfill job to the half of it to be sure we finish + // before the warning is logged. + // + // See `reth_db::implementation::mdbx::tx::LONG_TRANSACTION_DURATION`. + max_duration: Some(Duration::from_secs(30)), + ..Default::default() + }, stream_parallelism: DEFAULT_PARALLELISM, } }