DRY and fix comment

This commit is contained in:
Bryan Stitt 2023-01-23 21:08:24 -08:00
parent 56fcd68be7
commit cfa840a140
2 changed files with 4 additions and 4 deletions

View File

@ -9,7 +9,7 @@ use web3_proxy::app::{flatten_handle, flatten_handles, Web3ProxyApp};
use web3_proxy::config::TopConfig;
use web3_proxy::{frontend, metrics_frontend};
/// count requests
/// start the main proxy daemon
#[derive(FromArgs, PartialEq, Debug, Eq)]
#[argh(subcommand, name = "proxyd")]
pub struct ProxydSubCommand {

View File

@ -194,18 +194,18 @@ fn main() -> anyhow::Result<()> {
// set up tokio's async runtime
let mut rt_builder = runtime::Builder::new_multi_thread();
rt_builder.enable_all();
if let Some(top_config) = top_config.as_ref() {
let chain_id = top_config.app.chain_id;
rt_builder.enable_all().thread_name_fn(move || {
rt_builder.thread_name_fn(move || {
static ATOMIC_ID: AtomicUsize = AtomicUsize::new(0);
// TODO: what ordering? i think we want seqcst so that these all happen in order, but that might be stricter than we really need
let worker_id = ATOMIC_ID.fetch_add(1, atomic::Ordering::SeqCst);
// TODO: i think these max at 15 characters
format!("web3-{}-{}", chain_id, worker_id)
});
} else {
rt_builder.enable_all();
}
// start tokio's async runtime