Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable watchdog if watchdog_timeout_sec config is 0 #263

Merged
merged 2 commits into from
Dec 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/rbuilder/src/bin/dummy-builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ async fn main() -> eyre::Result<()> {
Arc<DatabaseEnv>,
MevBoostSlotDataGenerator,
> {
watchdog_timeout: Duration::from_secs(10000),
watchdog_timeout: Some(Duration::from_secs(10000)),
error_storage_path: None,
simulation_threads: 1,
blocks_source: payload_event,
Expand Down
8 changes: 6 additions & 2 deletions crates/rbuilder/src/live_builder/base_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,12 @@ impl BaseConfig {
Ok(http_provider(self.backtest_fetch_eth_rpc_url.parse()?))
}

pub fn watchdog_timeout(&self) -> Duration {
Duration::from_secs(self.watchdog_timeout_sec)
pub fn watchdog_timeout(&self) -> Option<Duration> {
if self.watchdog_timeout_sec != 0 {
Some(Duration::from_secs(self.watchdog_timeout_sec))
} else {
None
}
}

pub fn backtest_fetch_mempool_data_dir(&self) -> eyre::Result<PathBuf> {
Expand Down
14 changes: 11 additions & 3 deletions crates/rbuilder/src/live_builder/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ where
P: StateProviderFactory + Clone,
BlocksSourceType: SlotSource,
{
pub watchdog_timeout: Duration,
pub watchdog_timeout: Option<Duration>,
pub error_storage_path: Option<PathBuf>,
pub simulation_threads: usize,
pub order_input_config: OrderInputConfig,
Expand Down Expand Up @@ -178,7 +178,13 @@ where
self.run_sparse_trie_prefetcher,
);

let watchdog_sender = spawn_watchdog_thread(self.watchdog_timeout)?;
let watchdog_sender = match self.watchdog_timeout {
Some(duration) => Some(spawn_watchdog_thread(duration)?),
None => {
info!("Watchdog not enabled");
None
}
};

while let Some(payload) = payload_events_channel.recv().await {
if self.blocklist.contains(&payload.fee_recipient()) {
Expand Down Expand Up @@ -247,7 +253,9 @@ where
time_until_slot_end.try_into().unwrap_or_default(),
);

watchdog_sender.try_send(()).unwrap_or_default();
if let Some(watchdog_sender) = watchdog_sender.as_ref() {
watchdog_sender.try_send(()).unwrap_or_default();
};
}
}

Expand Down
Loading