Handle APNS request errors to ensure all device tokens receive a notification

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 <daniel@daquino.me>
Closes: https://github.com/damus-io/damus/issues/2408
This commit is contained in:
Daniel D’Aquino
2024-08-30 11:08:32 -07:00
parent 2abecf66c2
commit b548665b70

View File

@ -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);