Fix tightloop in push notficaiton

This commit is contained in:
QuantumEntangledAndy committed 2023-10-08 20:38:17 +07:00
1 parent 1195087d4b
commit 4d3c3ec610
2 files changed
+5 -3

No files matched your search

+4 -2
View File
@@ -250,12 +250,14 @@ impl NeoInstance {
loop {
match source_watch
.wait_for(|i| {
i.as_ref()
.is_some_and(|i| i.message.contains(&format!("\"{uid}\"")))
fwatch_tx.borrow().as_ref() != i.as_ref()
&& i.as_ref()
.is_some_and(|i| i.message.contains(&format!("\"{uid}\"")))
})
.await
{
Ok(pn) => {
log::debug!("Sending push notification: {:?} about {}", *pn, uid);
let _ = fwatch_tx.send_replace(pn.clone());
}
Err(e) => {
+1 -1
View File
@@ -23,7 +23,7 @@ pub(crate) struct PushNotiThread {
}
// The push notification
#[derive(Clone, Eq, PartialEq)]
#[derive(Clone, Eq, PartialEq, Debug)]
pub(crate) struct PushNoti {
pub(crate) message: String,
pub(crate) id: Option<String>,