chore: name tokio rt threads (#21777)

This commit is contained in:
DaniPopes
2026-02-04 16:23:22 +01:00
committed by GitHub
parent 1fc3d2c4ae
commit a3f7431d28
3 changed files with 16 additions and 33 deletions

View File

@@ -219,7 +219,14 @@ impl CliRunnerConfig {
/// Creates a new default tokio multi-thread [Runtime](tokio::runtime::Runtime) with all features
/// enabled
pub fn tokio_runtime() -> Result<tokio::runtime::Runtime, std::io::Error> {
tokio::runtime::Builder::new_multi_thread().enable_all().build()
tokio::runtime::Builder::new_multi_thread()
.enable_all()
// Keep the threads alive for at least the block time (12 seconds) plus buffer.
// This prevents the costly process of spawning new threads on every
// new block, and instead reuses the existing threads.
.thread_keep_alive(Duration::from_secs(15))
.thread_name("tokio-rt")
.build()
}
/// Runs the given future to completion or until a critical task panicked.