mirror of
git://git.proxmox.com/git/proxmox-backup.git
synced 2025-01-08 21:18:07 +03:00
backup-proxy: avoid block in if condition
Fixes the clippy lint: ``` warning: in a `match` scrutinee, avoid complex blocks or closures with blocks; instead, move the block or closure higher and bind it with a `let` --> src/bin/proxmox-backup-proxy.rs:874:58 | 874 | let stats = match tokio::task::spawn_blocking(|| { | __________________________________________________________^ 875 | | let hoststats = collect_host_stats_sync(); 876 | | let (hostdisk, datastores) = collect_disk_stats_sync(); 877 | | Arc::new((hoststats, hostdisk, datastores)) 878 | | }) | |_________^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#blocks_in_conditions = note: `#[warn(clippy::blocks_in_conditions)]` on by default ``` Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
This commit is contained in:
parent
c65fee708f
commit
55d50f1344
@ -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}");
|
||||
|
Loading…
Reference in New Issue
Block a user