Skip to content

Commit 5820151

Browse files
committed
node: Log the setting of MAX_BLOCKING_THREADS
1 parent 8186249 commit 5820151

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

node/src/main.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,17 @@ use graph_node::{launcher, opt};
99

1010
git_testament!(TESTAMENT);
1111

12-
fn main() {
13-
let max_blocking: usize = std::env::var("GRAPH_MAX_BLOCKING_THREADS")
12+
lazy_static! {
13+
pub static ref MAX_BLOCKING_THREADS: usize = std::env::var("GRAPH_MAX_BLOCKING_THREADS")
1414
.ok()
1515
.and_then(|v| v.parse().ok())
1616
.unwrap_or(512);
17+
}
1718

19+
fn main() {
1820
tokio::runtime::Builder::new_multi_thread()
1921
.enable_all()
20-
.max_blocking_threads(max_blocking)
22+
.max_blocking_threads(*MAX_BLOCKING_THREADS)
2123
.build()
2224
.unwrap()
2325
.block_on(async { main_inner().await })
@@ -30,7 +32,10 @@ async fn main_inner() {
3032

3133
// Set up logger
3234
let logger = logger(opt.debug);
33-
35+
debug!(
36+
logger,
37+
"Runtime configured with {} max blocking threads", *MAX_BLOCKING_THREADS
38+
);
3439
let ipfs_client = graph::ipfs::new_ipfs_client(&opt.ipfs, &logger)
3540
.await
3641
.unwrap_or_else(|err| panic!("Failed to create IPFS client: {err:#}"));

0 commit comments

Comments
 (0)