From ccd39c5e65539ca62fd561bf21ad5a39af50d4c4 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Thu, 19 Oct 2023 09:35:11 +0700 Subject: [PATCH] Remove extra use, and some more fixes --- src/common/pushnoti.rs | 8 ++++---- src/mqtt/mod.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/common/pushnoti.rs b/src/common/pushnoti.rs index 7725540..e11117b 100644 --- a/src/common/pushnoti.rs +++ b/src/common/pushnoti.rs @@ -117,14 +117,14 @@ impl PushNotiThread { let mut listener = FcmPushListener::create( registration, |message: FcmMessage| { - log::debug!("Got FCM Message: {message.payload_json:?}"); + log::debug!("Got FCM Message: {:?}", message.payload_json); + if let Some(id) = message.persistent_id.clone() { + let _ = sender.try_send(PnRequest::AddPushID { id }); // Don't worry if queue is full we will just not register as received yet + } thread_pn_watcher.send_replace(Some(PushNoti { message: message.payload_json, id: message.persistent_id, })); - if let Some(id) = message.persistent_id { - let _ = sender.try_send(PnRequest::AddPushID { id }); // Don't await not worth it - } }, self.received_ids.clone(), ); diff --git a/src/mqtt/mod.rs b/src/mqtt/mod.rs index c90e14f..029059a 100644 --- a/src/mqtt/mod.rs +++ b/src/mqtt/mod.rs @@ -64,7 +64,7 @@ use std::collections::{HashMap, HashSet}; use tokio::{ sync::mpsc::channel as mpsc, task::JoinSet, - time::{interval, sleep, sleep_until, Duration, Instant, MissedTickBehavior}, + time::{interval, sleep, Duration, MissedTickBehavior}, }; use tokio_stream::{wrappers::IntervalStream, StreamExt}; use tokio_util::sync::CancellationToken;