Kaynağa Gözat

client: manually configure tokio runtime

This doesn't do anything (significantly) different yet,
but allows us to play around with the configuration more easily.
Justin Tracey 3 ay önce
ebeveyn
işleme
7a1f725f8d
1 değiştirilmiş dosya ile 10 ekleme ve 2 silme
  1. 10 2
      src/bin/mgen-client.rs

+ 10 - 2
src/bin/mgen-client.rs

@@ -476,8 +476,7 @@ struct Config {
     conversations: Vec<ConversationConfig>,
 }
 
-#[tokio::main(flavor = "current_thread")]
-async fn main() -> Result<(), Box<dyn std::error::Error>> {
+async fn main_worker() -> Result<(), Box<dyn std::error::Error>> {
     #[cfg(feature = "tracing")]
     console_subscriber::init();
 
@@ -516,6 +515,15 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
     Ok(())
 }
 
+fn main() -> Result<(), Box<dyn std::error::Error>> {
+    tokio::runtime::Builder::new_multi_thread()
+        .worker_threads(2)
+        .enable_all()
+        .build()
+        .unwrap()
+        .block_on(main_worker())
+}
+
 #[cfg(test)]
 mod tests {
     use super::*;