diff options
Diffstat (limited to 'src/message/app.rs')
| -rw-r--r-- | src/message/app.rs | 32 |
1 files changed, 1 insertions, 31 deletions
diff --git a/src/message/app.rs b/src/message/app.rs index b79dad0..4bf96bf 100644 --- a/src/message/app.rs +++ b/src/message/app.rs @@ -1,7 +1,6 @@ use chrono::TimeDelta; use itertools::Itertools; use sqlx::sqlite::SqlitePool; -use web_push::WebPushError; use super::{Body, History, Id, Message, history, repo::Provider as _}; use crate::{ @@ -184,39 +183,10 @@ where self.events.broadcast_from(events.clone()); for event in events { - let failures = self - .publisher + self.publisher .publish(Event::from(event), &signer, &push_recipients) .await .fail("Failed to publish push events")?; - - if !failures.is_empty() { - let mut tx = self.db.begin().await.fail(db::failed::BEGIN)?; - // Note that data integrity guarantees from the original transaction to read - // subscriptions may no longer be valid now. Time has passed. Depending on how slow - // delivering push notifications is, potentially a _lot_ of time has passed. - - for (sub, err) in failures { - match err { - // I _think_ this is the complete set of permanent failures. See - // <https://docs.rs/web-push/latest/web_push/enum.WebPushError.html> for a complete - // list. - WebPushError::Unauthorized(_) - | WebPushError::InvalidUri - | WebPushError::EndpointNotValid(_) - | WebPushError::EndpointNotFound(_) - | WebPushError::InvalidCryptoKeys - | WebPushError::MissingCryptoKeys => { - tx.push().unsubscribe(sub).await.fail( - "Failed to unsubscribe after permanent push message rejection", - )?; - } - _ => (), - } - } - - tx.commit().await.fail(db::failed::COMMIT)?; - } } Ok(message.as_sent()) |
