From d1b279ed7fab617c962c75712c1792354bc1fdc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E1=B4=80=E1=B4=8D=E1=B4=9B=E1=B4=8F=E1=B4=80=E1=B4=87?= =?UTF-8?q?=CA=80?= Date: Thu, 11 Dec 2025 11:35:36 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E6=94=B9=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E9=81=BF=E5=85=8D=E6=9F=90=E4=BA=9B?= =?UTF-8?q?=E5=AD=98=E5=82=A8=E7=A9=BA=E9=97=B4=E7=94=B1=E4=BA=8E=E7=A3=81?= =?UTF-8?q?=E7=9B=98=E7=B1=BB=E5=9E=8B=E6=8E=A2=E6=B5=8B=E5=A4=B1=E8=B4=A5?= =?UTF-8?q?=E8=80=8C=E8=A2=AB=E9=94=99=E8=AF=AF=E8=BF=87=E6=BB=A4=E7=9A=84?= =?UTF-8?q?=E6=83=85=E5=86=B5=20(#568)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crates/bili_sync/src/api/routes/ws/mod.rs | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/crates/bili_sync/src/api/routes/ws/mod.rs b/crates/bili_sync/src/api/routes/ws/mod.rs index 53e9780..3e297e1 100644 --- a/crates/bili_sync/src/api/routes/ws/mod.rs +++ b/crates/bili_sync/src/api/routes/ws/mod.rs @@ -16,8 +16,8 @@ pub use log_helper::{LogHelper, MAX_HISTORY_LOGS}; use parking_lot::RwLock; use serde::{Deserialize, Serialize}; use sysinfo::{ - CpuRefreshKind, DiskKind, DiskRefreshKind, Disks, MemoryRefreshKind, Pid, ProcessRefreshKind, ProcessesToUpdate, - System, get_current_pid, + CpuRefreshKind, DiskRefreshKind, Disks, MemoryRefreshKind, Pid, ProcessRefreshKind, ProcessesToUpdate, System, + get_current_pid, }; use tokio::sync::mpsc; use tokio::{pin, select}; @@ -248,7 +248,13 @@ impl WebSocketHandler { }; let (available, total) = disks .iter() - .filter(|d| !matches!(d.kind(), DiskKind::Unknown(_))) + .filter(|d| { + d.available_space() > 0 + && d.total_space() > 0 + // 简单过滤一些虚拟文件系统 + && !["overlay", "tmpfs", "sysfs", "proc"] + .contains(&d.file_system().to_string_lossy().as_ref()) + }) .unique_by(|d| d.name()) .fold((0, 0), |(mut available, mut total), d| { available += d.available_space(); @@ -326,6 +332,6 @@ impl SysInfoExt for System { impl SysInfoExt for Disks { fn refresh_needed(&mut self, _self_pid: Pid) { - self.refresh_specifics(true, DiskRefreshKind::nothing().with_storage().with_kind()); + self.refresh_specifics(true, DiskRefreshKind::nothing().with_storage()); } }