From a8cc4367bdbee0c0ea2dddd5ede7e4856e23d85d Mon Sep 17 00:00:00 2001 From: Kirill Fomichev Date: Mon, 8 Jan 2024 18:27:37 -0500 Subject: [PATCH] geyser: set custom names to tokio threads --- src/plugin.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/plugin.rs b/src/plugin.rs index 03bf43e..ca88a7b 100644 --- a/src/plugin.rs +++ b/src/plugin.rs @@ -8,7 +8,11 @@ use { GeyserPlugin, GeyserPluginError, ReplicaAccountInfoVersions, ReplicaBlockInfoVersions, ReplicaTransactionInfoVersions, Result as PluginResult, SlotStatus, }, - tokio::{runtime::Runtime, time::Duration}, + std::sync::atomic::{AtomicUsize, Ordering}, + tokio::{ + runtime::{Builder, Runtime}, + time::Duration, + }, }; #[derive(Debug)] @@ -45,7 +49,16 @@ impl GeyserPlugin for Plugin { solana_logger::setup_with_default(&config.log.level); // Create inner - let runtime = Runtime::new().map_err(|error| GeyserPluginError::Custom(Box::new(error)))?; + let runtime = Builder::new_multi_thread() + .thread_name_fn(|| { + static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0); + let id = ATOMIC_ID.fetch_add(1, Ordering::Relaxed); + format!("solGeyserSqs{id:02}") + }) + .enable_all() + .build() + .map_err(|error| GeyserPluginError::Custom(Box::new(error)))?; + let prometheus = PrometheusService::new(&runtime, config.prometheus); let client = runtime .block_on(AwsSqsClient::new(config))