]> git.proxmox.com Git - proxmox-backup.git/commitdiff
server/rest: code cleanup: use async
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 12 Oct 2020 08:36:32 +0000 (10:36 +0200)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Mon, 12 Oct 2020 11:36:45 +0000 (13:36 +0200)
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/server/rest.rs

index c985ccbd06e62845e96883d1005ac11f90651b80..00a7f5303e63d2eab40b8ea251ced4bb4d203f82 100644 (file)
@@ -140,9 +140,10 @@ impl tower_service::Service<Request<Body>> for ApiService {
         let path = req.uri().path().to_owned();
         let method = req.method().clone();
 
+        let config = Arc::clone(&self.api_config);
         let peer = self.peer;
-        handle_request(self.api_config.clone(), req)
-            .map(move |result| match result {
+        async move {
+            match handle_request(config, req).await {
                 Ok(res) => {
                     log_response(&peer, method, &path, &res);
                     Ok::<_, Self::Error>(res)
@@ -160,8 +161,9 @@ impl tower_service::Service<Request<Body>> for ApiService {
                         Ok(resp)
                     }
                 }
-            })
-            .boxed()
+            }
+        }
+        .boxed()
     }
 }