From 63c7494e2cdfc690a5ce0119e993f5354073be29 Mon Sep 17 00:00:00 2001 From: IAmTomahawkx Date: Wed, 27 Nov 2024 10:07:54 -0800 Subject: [PATCH] fix: changes Signed-off-by: IAmTomahawkx --- Cargo.toml | 4 ---- crates/core/database/src/tasks/ack.rs | 4 ++-- crates/daemons/pushd/src/consumers/base.rs | 0 crates/daemons/pushd/src/consumers/inbound/ack.rs | 15 +++------------ 4 files changed, 5 insertions(+), 18 deletions(-) delete mode 100644 crates/daemons/pushd/src/consumers/base.rs diff --git a/Cargo.toml b/Cargo.toml index f99811437..2779c26bb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,9 +11,5 @@ members = [ ] [patch.crates-io] -# mobc-redis = { git = "https://github.com/insertish/mobc", rev = "8b880bb59f2ba80b4c7bc40c649c113d8857a186" } redis22 = { package = "redis", version = "0.22.3", git = "https://github.com/revoltchat/redis-rs", rev = "1a41faf356fd21aebba71cea7eb7eb2653e5f0ef" } redis23 = { package = "redis", version = "0.23.1", git = "https://github.com/revoltchat/redis-rs", rev = "f8ca28ab85da59d2ccde526b4d2fb390eff5a5f9" } -#authifier = { package = "authifier", version = "1.0.9", path = "../authifier/crates/authifier" } -#rocket_authifier = { package = "rocket_authifier", version = "1.0.9", path = "../authifier/crates/rocket_authifier" } -#rocket_empty = { package = "rocket_empty", version = "0.1.2", git = "https://github.com/IAmTomahawkx/rocket_empty", rev = "4be43b75ef740324a0cd7a1d9866e53ae1dc586e" } diff --git a/crates/core/database/src/tasks/ack.rs b/crates/core/database/src/tasks/ack.rs index c3f84110f..89971f661 100644 --- a/crates/core/database/src/tasks/ack.rs +++ b/crates/core/database/src/tasks/ack.rs @@ -89,8 +89,8 @@ pub async fn handle_ack_event( match &event { #[allow(clippy::disallowed_methods)] // event is sent by higher level function AckEvent::AckMessage { id } => { - let _u = user.as_ref().unwrap(); - let user: &str = _u.as_str(); + let user = user.as_ref().unwrap(); + let user: &str = user.as_str(); let unread = db.fetch_unread(user, channel).await?; let updated = db.acknowledge_message(channel, user, id).await?; diff --git a/crates/daemons/pushd/src/consumers/base.rs b/crates/daemons/pushd/src/consumers/base.rs deleted file mode 100644 index e69de29bb..000000000 diff --git a/crates/daemons/pushd/src/consumers/inbound/ack.rs b/crates/daemons/pushd/src/consumers/inbound/ack.rs index 2a46ebf8e..b9fe08861 100644 --- a/crates/daemons/pushd/src/consumers/inbound/ack.rs +++ b/crates/daemons/pushd/src/consumers/inbound/ack.rs @@ -67,12 +67,9 @@ impl AsyncConsumer for AckConsumer { let content = String::from_utf8(content).unwrap(); let payload: AckPayload = serde_json::from_str(content.as_str()).unwrap(); - log::debug!("Received Ack event"); - // Step 1: fetch unreads and don't continue if there's no unreads #[allow(clippy::disallowed_methods)] let unreads = self.db.fetch_unread_mentions(&payload.user_id).await; - println!("unreads: {:?}", unreads); if let Ok(u) = &unreads { if u.is_empty() { @@ -101,16 +98,12 @@ impl AsyncConsumer for AckConsumer { return; } - println!("sessions: {:?}", apple_sessions); - // Step 3: calculate the actual mention count, since we have to send it out let mut mention_count = 0; for u in &unreads.unwrap() { mention_count += u.mentions.as_ref().unwrap().len() } - println!("mention count: {}", mention_count); - // Step 4: loop through each apple session and send the badge update for session in apple_sessions { let service_payload = PayloadToService { @@ -129,19 +122,17 @@ impl AsyncConsumer for AckConsumer { ) .finish(); - println!( + log::debug!( "Publishing ack to apn session {}", session.subscription.as_ref().unwrap().auth ); publish_message(self, p.into(), args).await; } else { - println!("Failed to serialize ack badge update payload!"); - println!("{:?}", raw_service_payload.unwrap_err()) + log::warn!("Failed to serialize ack badge update payload!"); + revolt_config::capture_error(&raw_service_payload.unwrap_err()); } } - - println!("Done!"); } } }