Skip to content

Commit c80ae60

Browse files
author
Ludo Galabru
committed
fix: multithreading cap
1 parent be91202 commit c80ae60

File tree

1 file changed

+6
-6
lines changed
  • components/hord-cli/src/hord

1 file changed

+6
-6
lines changed

components/hord-cli/src/hord/mod.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -1186,12 +1186,12 @@ pub fn retrieve_inscribed_satoshi_points_from_block_v3(
11861186

11871187
let has_transactions_to_process = !transactions_ids.is_empty() || !l1_cache_hits.is_empty();
11881188

1189+
let thread_max = hord_config.ingestion_thread_max * 3;
1190+
11891191
if has_transactions_to_process {
11901192
let expected_traversals = transactions_ids.len() + l1_cache_hits.len();
11911193
let (traversal_tx, traversal_rx) = channel();
11921194

1193-
let thread_max = hord_config.ingestion_thread_max * 3;
1194-
11951195
let traversal_data_pool = ThreadPool::new(thread_max);
11961196
let mut tx_thread_pool = vec![];
11971197

@@ -1228,7 +1228,7 @@ pub fn retrieve_inscribed_satoshi_points_from_block_v3(
12281228
for key in l1_cache_hits.iter() {
12291229
if let Some(entry) = cache_l1.remove(key) {
12301230
let _ = traversal_tx.send((Ok(entry), true, thread_index));
1231-
thread_index = (thread_index + 1) % hord_config.ingestion_thread_max;
1231+
thread_index = (thread_index + 1) % thread_max;
12321232
}
12331233
}
12341234

@@ -1258,10 +1258,10 @@ pub fn retrieve_inscribed_satoshi_points_from_block_v3(
12581258
}
12591259

12601260
// Feed each workers with 2 workitems each
1261-
for thread_index in 0..hord_config.ingestion_thread_max {
1261+
for thread_index in 0..thread_max {
12621262
let _ = tx_thread_pool[thread_index].send(priority_queue.pop_front());
12631263
}
1264-
for thread_index in 0..hord_config.ingestion_thread_max {
1264+
for thread_index in 0..thread_max {
12651265
let _ = tx_thread_pool[thread_index].send(priority_queue.pop_front());
12661266
}
12671267

@@ -1335,7 +1335,7 @@ pub fn retrieve_inscribed_satoshi_points_from_block_v3(
13351335
}
13361336
}
13371337
}
1338-
for thread_index in 0..hord_config.ingestion_thread_max {
1338+
for thread_index in 0..thread_max {
13391339
let _ = tx_thread_pool[thread_index].send(None);
13401340
}
13411341

0 commit comments

Comments
 (0)