diff --git a/UPDATELOG.md b/UPDATELOG.md index b38c286f..10c90113 100644 --- a/UPDATELOG.md +++ b/UPDATELOG.md @@ -73,6 +73,7 @@ - 修复首页自定义卡片在切换轻量模式时失效 - 修复悬浮跳转导航失效 - 修复小键盘热键映射错误 +- 修复后端无法通知前端事件 ## v2.4.2 diff --git a/src-tauri/src/core/notification.rs b/src-tauri/src/core/notification.rs index 08102fc0..071bcedb 100644 --- a/src-tauri/src/core/notification.rs +++ b/src-tauri/src/core/notification.rs @@ -96,10 +96,17 @@ impl NotificationSystem { let handle = Handle::global(); while !handle.is_exiting() { - match rx.recv_timeout(std::time::Duration::from_millis(100)) { + match rx.recv() { Ok(event) => Self::process_event(handle, event), - Err(mpsc::RecvTimeoutError::Disconnected) => break, - Err(mpsc::RecvTimeoutError::Timeout) => break, + Err(e) => { + logging!( + error, + Type::System, + "receive event error, stop notification worker: {}", + e + ); + break; + } } } }