sui_core/
runtime.rs

1// Copyright (c) Mysten Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4use sui_config::NodeConfig;
5use tokio::runtime::Runtime;
6
7pub struct SuiRuntimes {
8    // Order in this struct is the order in which runtimes are stopped
9    pub sui_node: Runtime,
10    pub metrics: Runtime,
11}
12
13impl SuiRuntimes {
14    pub fn new(_confg: &NodeConfig) -> Self {
15        let sui_node = tokio::runtime::Builder::new_multi_thread()
16            .thread_name("sui-node-runtime")
17            .enable_all()
18            .build()
19            .unwrap();
20        let metrics = tokio::runtime::Builder::new_multi_thread()
21            .thread_name("metrics-runtime")
22            .worker_threads(2)
23            .enable_all()
24            .build()
25            .unwrap();
26
27        Self { sui_node, metrics }
28    }
29}