diff --git a/src-tauri/src/core/notification.rs b/src-tauri/src/core/notification.rs index 071bcedb..50968bec 100644 --- a/src-tauri/src/core/notification.rs +++ b/src-tauri/src/core/notification.rs @@ -1,3 +1,4 @@ +use super::handle::Handle; use crate::{ constants::{retry, timing}, logging, @@ -91,22 +92,12 @@ impl NotificationSystem { } fn worker_loop(rx: mpsc::Receiver) { - use super::handle::Handle; - let handle = Handle::global(); - while !handle.is_exiting() { - match rx.recv() { + match rx.try_recv() { Ok(event) => Self::process_event(handle, event), - Err(e) => { - logging!( - error, - Type::System, - "receive event error, stop notification worker: {}", - e - ); - break; - } + Err(mpsc::TryRecvError::Disconnected) => break, + Err(mpsc::TryRecvError::Empty) => break, } } }