diff --git a/functions/src/billing/onEntitlementChanged.ts b/functions/src/billing/onEntitlementChanged.ts index bfd49349..77498472 100644 --- a/functions/src/billing/onEntitlementChanged.ts +++ b/functions/src/billing/onEntitlementChanged.ts @@ -1,5 +1,6 @@ import * as functions from 'firebase-functions' import * as admin from 'firebase-admin' +import { pruneDeadTokens } from '../notifications/pruneTokens' /** * Notifies the OTHER partner when a user GAINS premium, so couple-shared premium unlock isn't silent @@ -110,5 +111,6 @@ export const onEntitlementChanged = functions.firestore console.warn(`[onEntitlementChanged] send failed ${tokens[i]}: ${String(r.reason)}`) } }) + await pruneDeadTokens(db, partnerId, tokens, results) console.log(`[onEntitlementChanged] notified ${partnerId} of couple premium (${coupleId})`) })