From b548665b703318a5e82184a138832b28e55b1197 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20D=E2=80=99Aquino?= Date: Fri, 30 Aug 2024 11:08:32 -0700 Subject: [PATCH] Handle APNS request errors to ensure all device tokens receive a notification MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit fixes an issue where having one invalid device token registered can cause other device tokens to not receive push notifications. The issue was fixed by improving error handling around APNS requests Signed-off-by: Daniel D’Aquino Closes: https://github.com/damus-io/damus/issues/2408 --- src/notification_manager/notification_manager.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/notification_manager/notification_manager.rs b/src/notification_manager/notification_manager.rs index 739403d..1f9ed34 100644 --- a/src/notification_manager/notification_manager.rs +++ b/src/notification_manager/notification_manager.rs @@ -379,7 +379,11 @@ impl NotificationManager { let apns_client_mutex_guard = self.apns_client.lock().await; - let _response = apns_client_mutex_guard.send(payload).await?; + + match apns_client_mutex_guard.send(payload).await { + Ok(_response) => {}, + Err(e) => log::error!("Failed to send notification to device token '{}': {}", device_token, e), + } log::info!("Notification sent to device token: {}", device_token);