mirror of
https://github.com/paradigmxyz/reth.git
synced 2026-02-19 03:04:27 -05:00
fix(flashblocks): Add flashblock ws connection retry period (#20510)
This commit is contained in:
@@ -12,10 +12,18 @@ use reth_primitives_traits::{AlloyBlockHeader, BlockTy, HeaderTy, NodePrimitives
|
||||
use reth_revm::cached::CachedReads;
|
||||
use reth_storage_api::{BlockReaderIdExt, StateProviderFactory};
|
||||
use reth_tasks::TaskExecutor;
|
||||
use std::{sync::Arc, time::Instant};
|
||||
use tokio::sync::{oneshot, watch};
|
||||
use std::{
|
||||
sync::Arc,
|
||||
time::{Duration, Instant},
|
||||
};
|
||||
use tokio::{
|
||||
sync::{oneshot, watch},
|
||||
time::sleep,
|
||||
};
|
||||
use tracing::*;
|
||||
|
||||
const CONNECTION_BACKOUT_PERIOD: Duration = Duration::from_secs(5);
|
||||
|
||||
/// The `FlashBlockService` maintains an in-memory [`PendingFlashBlock`] built out of a sequence of
|
||||
/// [`FlashBlock`]s.
|
||||
#[derive(Debug)]
|
||||
@@ -167,7 +175,13 @@ where
|
||||
self.try_start_build_job();
|
||||
}
|
||||
Some(Err(err)) => {
|
||||
warn!(target: "flashblocks", %err, "Error receiving flashblock");
|
||||
warn!(
|
||||
target: "flashblocks",
|
||||
%err,
|
||||
retry_period = CONNECTION_BACKOUT_PERIOD.as_secs(),
|
||||
"Error receiving flashblock"
|
||||
);
|
||||
sleep(CONNECTION_BACKOUT_PERIOD).await;
|
||||
}
|
||||
None => {
|
||||
warn!(target: "flashblocks", "Flashblock stream ended");
|
||||
|
||||
Reference in New Issue
Block a user