feat(dates): wire pruneDeadTokens into createDateMatch
This commit is contained in:
parent
342ca37e91
commit
f8240e01a9
|
|
@ -1,5 +1,6 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
import { pruneDeadTokens } from '../notifications/pruneTokens'
|
||||
|
||||
/**
|
||||
* Fires the "It's a match!" notification when a date match is created.
|
||||
|
|
@ -60,7 +61,7 @@ async function notifyDateMatch(
|
|||
const tokens = await getUserTokens(db, userId)
|
||||
if (tokens.length === 0) return
|
||||
|
||||
await Promise.allSettled(
|
||||
const results = await Promise.allSettled(
|
||||
tokens.map((token) =>
|
||||
admin.messaging().send({
|
||||
token,
|
||||
|
|
@ -77,6 +78,7 @@ async function notifyDateMatch(
|
|||
})
|
||||
)
|
||||
)
|
||||
await pruneDeadTokens(db, userId, tokens, results)
|
||||
}
|
||||
|
||||
async function getUserTokens(
|
||||
|
|
|
|||
Loading…
Reference in New Issue