Skip to content

Commit

Permalink
chore: don't box some futures (paradigmxyz#6728)
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes authored Feb 21, 2024
1 parent 1269528 commit 39cd900
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
2 changes: 1 addition & 1 deletion bin/reth/src/commands/debug_cmd/replay_engine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl Command {
let (payload_service, payload_builder): (_, PayloadBuilderHandle<EthEngineTypes>) =
PayloadBuilderService::new(payload_generator, blockchain_db.canonical_state_stream());

ctx.task_executor.spawn_critical("payload builder service", Box::pin(payload_service));
ctx.task_executor.spawn_critical("payload builder service", payload_service);

// Configure the consensus engine
let network_client = network.fetch_client().await?;
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc/rpc/src/eth/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ where
let eth_filter = Self { inner: Arc::new(inner) };

let this = eth_filter.clone();
eth_filter.inner.task_spawner.clone().spawn_critical(
eth_filter.inner.task_spawner.spawn_critical(
"eth-filters_stale-filters-clean",
Box::pin(async move {
this.watch_and_clear_stale_filters().await;
Expand Down
16 changes: 5 additions & 11 deletions crates/tasks/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,7 @@ mod tests {
let manager = TaskManager::new(handle);
let executor = manager.executor();

executor.spawn_critical(
"this is a critical task",
Box::pin(async { panic!("intentionally panic") }),
);
executor.spawn_critical("this is a critical task", async { panic!("intentionally panic") });

runtime.block_on(async move {
let err = manager.await;
Expand All @@ -678,13 +675,10 @@ mod tests {

let (signal, shutdown) = signal();

executor.spawn_critical(
"this is a critical task",
Box::pin(async move {
tokio::time::sleep(Duration::from_millis(200)).await;
drop(signal);
}),
);
executor.spawn_critical("this is a critical task", async move {
tokio::time::sleep(Duration::from_millis(200)).await;
drop(signal);
});

drop(manager);

Expand Down

0 comments on commit 39cd900

Please sign in to comment.