From e35b8151c69f19fe0d4395888ec6ead0297cda61 Mon Sep 17 00:00:00 2001 From: null Date: Tue, 30 Jun 2026 23:35:49 -0500 Subject: [PATCH] feat(notifications): wire pruneDeadTokens into reengagement --- functions/src/notifications/reengagement.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/functions/src/notifications/reengagement.ts b/functions/src/notifications/reengagement.ts index 131916e1..fe92e5c4 100644 --- a/functions/src/notifications/reengagement.ts +++ b/functions/src/notifications/reengagement.ts @@ -1,6 +1,7 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' import { recipientInQuietHours } from './quietHours' +import { pruneDeadTokens } from './pruneTokens' const THREE_DAYS_MS = 3 * 24 * 60 * 60 * 1000 const TEN_DAYS_MS = 10 * 24 * 60 * 60 * 1000 @@ -102,7 +103,7 @@ async function sendNudge( const tokens = await getUserTokens(db, userId, userData) if (tokens.length === 0) return - await Promise.allSettled( + const results = await Promise.allSettled( tokens.map((token) => messaging.send({ token, @@ -118,6 +119,7 @@ async function sendNudge( }) ) ) + await pruneDeadTokens(db, userId, tokens, results) } async function getUserTokens(