fix(exex): limit the duration of a backfill job to 30 seconds (#11450)

This commit is contained in:
Alexey Shekhirin
2024-10-03 15:10:08 +03:00
committed by GitHub
parent 73d5ce78c3
commit 601c6fe73e

View File

@ -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<E, P> BackfillJobFactory<E, P> {
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,
}
}