Pārlūkot izejas kodu

API works in parallel with downloading emails

Yurii Sokolovskyi 2 mēneši atpakaļ
vecāks
revīzija
0b825c6684
1 mainītis faili ar 6 papildinājumiem un 3 dzēšanām
  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