Skip to content

Commit

Permalink
ref: Add names to tokio runtime threads (#1688)
Browse files Browse the repository at this point in the history
  • Loading branch information
TBS1996 authored Dec 9, 2022
1 parent e91e1bf commit 1078cda
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
10 changes: 5 additions & 5 deletions relay-server/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ impl ServiceState {
let system = System::current();
let registry = system.registry();

let main_runtime = utils::create_runtime(config.cpu_concurrency());
let project_runtime = utils::create_runtime(1);
let aggregator_runtime = utils::create_runtime(1);
let outcome_runtime = utils::create_runtime(1);
let main_runtime = utils::create_runtime("main-rt", config.cpu_concurrency());
let project_runtime = utils::create_runtime("project-rt", 1);
let aggregator_runtime = utils::create_runtime("aggregator-rt", 1);
let outcome_runtime = utils::create_runtime("outcome-rt", 1);
let mut _store_runtime = None;

let upstream_relay = UpstreamRelay::new(config.clone());
Expand All @@ -150,7 +150,7 @@ impl ServiceState {

#[cfg(feature = "processing")]
if config.processing_enabled() {
let rt = utils::create_runtime(1);
let rt = utils::create_runtime("store-rt", 1);
let _guard = rt.enter();
let store = StoreService::create(config.clone())?.start();
envelope_manager.set_store_forwarder(store);
Expand Down
3 changes: 2 additions & 1 deletion relay-server/src/utils/actix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@ use tokio::runtime::Runtime;
///
/// The calling thread must have the actix system enabled, panics if this is invoked in a thread
/// where actix is not enabled.
pub fn create_runtime(threads: usize) -> Runtime {
pub fn create_runtime(name: &str, threads: usize) -> Runtime {
let system = System::current();
tokio::runtime::Builder::new_multi_thread()
.thread_name(name)
.worker_threads(threads)
.enable_all()
.on_thread_start(move || System::set_current(system.clone()))
Expand Down

0 comments on commit 1078cda

Please sign in to comment.