fix: opti
This commit is contained in:
parent
d6bd2308a1
commit
e4da0f59b3
1 changed files with 13 additions and 12 deletions
|
@ -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")
|
logger.debug({ alertId }, "Querying alert record")
|
||||||
const [{ userId: alertUserId, level, code }] = await sql`
|
const [{ userId: alertUserId, level, code }] = await sql`
|
||||||
SELECT
|
SELECT
|
||||||
|
@ -188,6 +179,16 @@ module.exports = async function () {
|
||||||
"alert"."id" = ${alertId}
|
"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) {
|
if (alertUserId === alertingUserId) {
|
||||||
logger.info(
|
logger.info(
|
||||||
{ alertUserId, alertingUserId },
|
{ alertUserId, alertingUserId },
|
||||||
|
|
Loading…
Add table
Reference in a new issue