Compare commits
2 Commits
release-20
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4e81565ab6 | ||
|
|
795eef4bda |
@@ -191,23 +191,20 @@ pub async fn send_push_notification(
|
|||||||
tracing::debug!("Push notification sent to: {}", subscription.endpoint);
|
tracing::debug!("Push notification sent to: {}", subscription.endpoint);
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
tracing::error!("Failed to send push notification to {}: {}", subscription.endpoint, e);
|
let err_msg = format!("{:?}", e);
|
||||||
// If subscription is invalid/expired (Gone or Unauthorized), remove it
|
tracing::error!("Delivery failed for {}: {}", subscription.endpoint, err_msg);
|
||||||
if format!("{:?}", e).contains("Unauthorized") || format!("{:?}", e).contains("Gone") {
|
// Always remove on delivery failure (Gone, Unauthorized, etc.)
|
||||||
tracing::info!("Removing invalid subscription: {}", subscription.endpoint);
|
tracing::info!("Removing problematic subscription after delivery failure: {}", subscription.endpoint);
|
||||||
let _ = store.remove_subscription(&subscription.endpoint).await;
|
let _ = store.remove_subscription(&subscription.endpoint).await;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let err_msg = format!("{:?}", e);
|
let err_msg = format!("{:?}", e);
|
||||||
tracing::error!("Failed to build push message for {}: {}", subscription.endpoint, err_msg);
|
tracing::error!("Encryption/Build failed for {}: {}", subscription.endpoint, err_msg);
|
||||||
// Broaden error matching to catch various encryption and auth failures
|
// Always remove on encryption failure
|
||||||
if err_msg.contains("encrypting") || err_msg.contains("Vapid") || err_msg.contains("Unauthorized") {
|
tracing::info!("Removing problematic subscription after encryption failure: {}", subscription.endpoint);
|
||||||
tracing::warn!("Critical push error for subscriber {}, removing invalid subscription", subscription.endpoint);
|
let _ = store.remove_subscription(&subscription.endpoint).await;
|
||||||
let _ = store.remove_subscription(&subscription.endpoint).await;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user