mirror of
https://github.com/clash-verge-rev/clash-verge-rev
synced 2025-05-04 23:43:44 +08:00
fix: timeout mechanism for sending notice messages
This commit is contained in:
parent
cfe8328f9e
commit
ce42ca77a9
@ -125,25 +125,12 @@ impl NotificationSystem {
|
|||||||
ref status,
|
ref status,
|
||||||
ref message,
|
ref message,
|
||||||
} => {
|
} => {
|
||||||
if let Err(e) = window.emit(
|
Self::emit_with_timeout(
|
||||||
|
&window,
|
||||||
"verge://notice-message",
|
"verge://notice-message",
|
||||||
(status.clone(), message.clone()),
|
(status.clone(), message.clone()),
|
||||||
) {
|
&handle,
|
||||||
log::warn!("Failed to send notice: {}", e);
|
);
|
||||||
if let Some(sys) = system_guard.as_ref() {
|
|
||||||
sys.stats
|
|
||||||
.total_errors
|
|
||||||
.fetch_add(1, Ordering::SeqCst);
|
|
||||||
*sys.stats.last_error_time.write() =
|
|
||||||
Some(Instant::now());
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if let Some(sys) = system_guard.as_ref() {
|
|
||||||
sys.stats
|
|
||||||
.total_sent
|
|
||||||
.fetch_add(1, Ordering::SeqCst);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user