Ver código fonte

API works in parallel with downloading emails

Yurii Sokolovskyi 2 meses atrás
pai
commit
0b825c6684
1 arquivos alterados com 6 adições e 3 exclusões
  1. 6 3
      src/main.rs

+ 6 - 3
src/main.rs

@@ -330,6 +330,12 @@ async fn run(){
     // parse args from CLI
     parse_args();
 
+    // API
+    tokio::spawn(async move {
+        run_api().await
+    });
+    // run_api().await;
+    
     // downloading new emails
     let new_paths = imap::download_email_from_imap().await.expect("Cannot download new emails");
     
@@ -373,9 +379,6 @@ async fn run(){
     if let Err(e) = check_for_updates("INBOX".to_string()).await {
         eprintln!("Failed to monitor mailbox: {:?}", e);
     }
-
-    // API
-    run_api().await;
 }
 
 /// Entry point for a wasi env