feat(notifications): wire pruneDeadTokens into sendThinkingOfYouCallable
This commit is contained in:
parent
5306d40c72
commit
f55c49010d
|
|
@ -1,6 +1,7 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import { recipientInQuietHours } from './quietHours'
|
import { recipientInQuietHours } from './quietHours'
|
||||||
|
import { pruneDeadTokens } from './pruneTokens'
|
||||||
|
|
||||||
const THINKING_OF_YOU_MAX_PER_DAY = 10
|
const THINKING_OF_YOU_MAX_PER_DAY = 10
|
||||||
const THINKING_OF_YOU_WINDOW_MS = 24 * 60 * 60 * 1000 // rolling 24h
|
const THINKING_OF_YOU_WINDOW_MS = 24 * 60 * 60 * 1000 // rolling 24h
|
||||||
|
|
@ -114,6 +115,7 @@ export const sendThinkingOfYouCallable = functions.https.onCall(async (_data, co
|
||||||
console.warn(`[sendThinkingOfYouCallable] FCM failed for token ${tokens[i]}:`, r.reason)
|
console.warn(`[sendThinkingOfYouCallable] FCM failed for token ${tokens[i]}:`, r.reason)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
await pruneDeadTokens(db, partnerId, tokens, results)
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`[sendThinkingOfYouCallable] sent from ${callerId} to ${partnerId} in couple ${coupleId}`)
|
console.log(`[sendThinkingOfYouCallable] sent from ${callerId} to ${partnerId} in couple ${coupleId}`)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue