fix: opti

This commit is contained in:
Jo 2025-08-24 11:53:15 +02:00
parent d6bd2308a1
commit e4da0f59b3
Signed by: devthejo
GPG key ID: 00CCA7A92B1D5351

View file

@ -167,15 +167,6 @@ module.exports = async function () {
}
}
let sentOnce = false
await async.allLimit(devices, MAX_PARALLEL_PUSHES, async (device) => {
const { id: deviceId, fcmToken } = device
const notificationAlertLevel = device.notificationAlertLevel || "green"
logger.debug(
{ deviceId, notificationAlertLevel },
"Found device record"
)
logger.debug({ alertId }, "Querying alert record")
const [{ userId: alertUserId, level, code }] = await sql`
SELECT
@ -188,6 +179,16 @@ module.exports = async function () {
"alert"."id" = ${alertId}
`
let sentOnce = false
await async.allLimit(devices, MAX_PARALLEL_PUSHES, async (device) => {
const { id: deviceId, fcmToken } = device
const notificationAlertLevel = device.notificationAlertLevel || "green"
logger.debug(
{ deviceId, notificationAlertLevel },
"Found device record"
)
if (alertUserId === alertingUserId) {
logger.info(
{ alertUserId, alertingUserId },