Skip to content
This repository was archived by the owner on Jan 2, 2025. It is now read-only.

Commit bcee5e5

Browse files
authored
Prioritize indexer threads (#590)
1 parent f104917 commit bcee5e5

File tree

3 files changed

+24
-5
lines changed

3 files changed

+24
-5
lines changed

Cargo.lock

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/bleep/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ scc = { version= "1.8.0", features = ["serde"] }
119119
sentry-tracing = "0.31.1"
120120
git-version = "0.3.5"
121121
gix = { version="0.44.1", features = ["blocking-http-transport-reqwest", "blocking-network-client", "pack-cache-lru-static"] }
122+
thread-priority = "0.13.1"
122123

123124
[target.'cfg(windows)'.dependencies]
124125
dunce = "1.0.4"

server/bleep/src/background.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use thread_priority::ThreadBuilderExt;
12
use tokio::sync::Semaphore;
23
use tracing::{debug, info};
34

@@ -72,11 +73,13 @@ impl BackgroundExecutor {
7273
_ = rayon::ThreadPoolBuilder::new()
7374
.spawn_handler(move |thread| {
7475
let tokio_ref = tokio_ref.clone();
75-
std::thread::spawn(move || {
76-
let _tokio = tokio_ref.enter();
77-
thread.run()
78-
});
79-
Ok(())
76+
std::thread::Builder::new()
77+
.name("index-worker".to_owned())
78+
.spawn_with_priority(thread_priority::ThreadPriority::Max, move |_| {
79+
let _tokio = tokio_ref.enter();
80+
thread.run()
81+
})
82+
.map(|_| ())
8083
})
8184
.num_threads(config.max_threads)
8285
.build_global();

0 commit comments

Comments
 (0)