Browse Source

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 9 months ago
parent
commit
7a1f725f8d
1 changed files with 10 additions and 2 deletions
  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::*;