Skip to content

Commit

Permalink
geyser: set custom names to tokio threads
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Jan 8, 2024
1 parent b2ced9b commit a8cc436
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit a8cc436

Please sign in to comment.