From 91b486df4f7918a5ed784f7a13822f94074fd274 Mon Sep 17 00:00:00 2001 From: Ginger Date: Wed, 2 Dec 2026 22:15:49 -0500 Subject: [PATCH] fix: Stop discarding errors when sending a push notification request --- src/service/sending/sender.rs | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/service/sending/sender.rs b/src/service/sending/sender.rs index a92cc195b..4f6a78ea4 100644 --- a/src/service/sending/sender.rs +++ b/src/service/sending/sender.rs @@ -1003,6 +1003,8 @@ impl Service { } } + let mut first_push_error = None; + for pdu in pdus { // Redacted events are not notification targets (we don't send push // for them) @@ -1028,15 +1030,27 @@ impl Service { .try_into() .expect("notification count can't go that high"); - let _response = self + let response = self .services .pusher .send_push_notice(&user_id, unread, &pusher, rules_for_user, &pdu) .await - .map_err(|e| (Destination::Push(user_id.clone(), pushkey.clone()), e)); + .map_err(|e| (Destination::Push(user_id.clone(), pushkey.clone()), Box::new(e))); + + if let Err(err) = response { + error!(event = %pdu.event_id, pusher = %pusher.app_display_name, "Failed to deliver push notification: {err:?}"); + + if first_push_error.is_none() { + first_push_error = Some(err); + } + } } - Ok(Destination::Push(user_id, pushkey)) + if let Some(err) = first_push_error { + Err(err) + } else { + Ok(Destination::Push(user_id, pushkey)) + } } async fn send_events_dest_federation(