]> git.proxmox.com Git - proxmox-backup.git/blobdiff - src/bin/proxmox-backup-proxy.rs
backup-proxy: avoid block in if condition
[proxmox-backup.git] / src / bin / proxmox-backup-proxy.rs
index 9c49026b6b244e0f25cf28ba07fcb6e9cb5c11dd..5d5bcdd3d1218190ba845c2395b6fc63c4b3de70 100644 (file)
@@ -871,13 +871,12 @@ async fn run_stat_generator() {
     loop {
         let delay_target = Instant::now() + Duration::from_secs(10);
 
-        let stats = match tokio::task::spawn_blocking(|| {
+        let stats_future = tokio::task::spawn_blocking(|| {
             let hoststats = collect_host_stats_sync();
             let (hostdisk, datastores) = collect_disk_stats_sync();
             Arc::new((hoststats, hostdisk, datastores))
-        })
-        .await
-        {
+        });
+        let stats = match stats_future.await {
             Ok(res) => res,
             Err(err) => {
                 log::error!("collecting host stats panicked: {err}");