git.lucas.co / cce-authenticator
login authentication (PAM + fingerprint)
git clone https://git.lucas.co/cce-authenticator.git

commit75eb0ec8861b51de446674920c44c079b5211e67
parentd354fce103
authorLucas Galante <lsgalante12@gmail.com>
date2026-10-06 18:22
Size the tokio runtime to two workers

The default multi-thread runtime spawns one worker per CPU (20 here) for
an agent whose D-Bus tasks are a handful of awaits (47 threads -> 31).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

 src/main.rs | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/src/main.rs b/src/main.rs
index 6f7fd01..8448575 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1404,7 +1404,14 @@ fn main() {
     let args: Vec<String> = std::env::args().collect();
     let standalone = args.contains(&"--standalone".to_string()) || args.contains(&"-s".to_string());
     
-    let rt = tokio::runtime::Runtime::new().expect("tokio runtime");
+    // Two workers: the agent's D-Bus tasks are a handful of awaits, and a
+    // runtime sized to the CPU count (20 here) parked 20 threads all session
+    // for them.
+    let rt = tokio::runtime::Builder::new_multi_thread()
+        .worker_threads(2)
+        .enable_all()
+        .build()
+        .expect("tokio runtime");
     let _guard = rt.enter();
     
     if standalone {