Delete old messages with SID when new messages arrive

This commit is contained in:
binwiederhier
2026-01-08 10:28:02 -05:00
parent bfbe73aea3
commit 75abf2e245
4 changed files with 43 additions and 35 deletions

View File

@@ -27,6 +27,11 @@ const addNotification = async ({ subscriptionId, message }) => {
// Note: SubscriptionManager duplicates this logic, so if you change it here, change it there too
// Delete existing notification with same SID (if any)
if (message.sid) {
await db.notifications.where({ subscriptionId, sid: message.sid }).delete();
}
// Add notification to database
await db.notifications.add({
...messageWithSID(message),