feat(heartbeat): remove
All checks were successful
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 3m2s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 3m6s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 3m21s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 3m17s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 2m44s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Successful in 2m56s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 3m11s
/ deploy (push) Successful in 34s
All checks were successful
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 3m2s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 3m6s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 3m21s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 3m17s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 2m44s
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Successful in 2m56s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 3m11s
/ deploy (push) Successful in 34s
This commit is contained in:
parent
42cddb2aa2
commit
9920f40268
5 changed files with 23 additions and 25 deletions
|
@ -9,8 +9,8 @@ function createBackgroundGeolocationLostNotification() {
|
|||
action: "background-geolocation-lost",
|
||||
},
|
||||
notification: {
|
||||
title: `Alerte-Secours ne peut plus accéder à votre position`,
|
||||
body: `Vous ne pouvez plus recevoir d'alertes de proximité. Vérifiez les paramètres.`,
|
||||
title: `Alerte-Secours ne reçoit plus de mises à jour de votre position`,
|
||||
body: `Vous ne pourrez plus recevoir d'alertes de proximité. Vérifiez les paramètres.`,
|
||||
channel: "system",
|
||||
priority: "high",
|
||||
actionId: "open-background-geolocation-settings",
|
||||
|
|
|
@ -8,9 +8,9 @@ module.exports = {
|
|||
SCAN_AUTO_CLOSE_CRON: "15 * * * *", // At minute 15
|
||||
SCAN_AUTO_ARCHIVE_CRON: "0 4 * * *", // At 4:00
|
||||
RELATIVE_UNREGISTERED_RECONCILIATION_CRON: "0 4 * * *", // At 4:00
|
||||
DEVICE_GEODATA_IOS_SILENT_PUSH_AGE: "24 hours", // When to send iOS silent push for heartbeat sync
|
||||
DEVICE_GEODATA_NOTIFICATION_AGE: "48 hours", // When to send push notification
|
||||
DEVICE_GEODATA_CLEANUP_AGE: "2 weeks", // When to remove/clean data
|
||||
// DEVICE_GEODATA_IOS_SILENT_PUSH_AGE: "24 hours", // When to send iOS silent push for heartbeat sync
|
||||
DEVICE_GEODATA_NOTIFICATION_AGE: "14 days", // When to send push notification
|
||||
DEVICE_GEODATA_CLEANUP_AGE: "15 days", // When to remove/clean data
|
||||
}
|
||||
|
||||
// cheat on https://crontab.guru/
|
||||
|
|
|
@ -10,5 +10,5 @@ module.exports = {
|
|||
RELATIVE_INVITATION_NOTIFY: "relativeInvitationNotify",
|
||||
ALERT_CALL_EMERGENCY_INFO_NOTIFY: "alertCallEmergencyInfoNotify",
|
||||
BACKGROUND_GEOLOCATION_LOST_NOTIFY: "backgroundGeolocationLostNotify",
|
||||
IOS_GEOLOCATION_HEARTBEAT_SYNC: "iosGeolocationHeartbeatSync",
|
||||
// IOS_GEOLOCATION_HEARTBEAT_SYNC: "iosGeolocationHeartbeatSync",
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ const { ctx } = require("@modjo/core")
|
|||
const ms = require("ms")
|
||||
const cron = require("~/libs/cron")
|
||||
const {
|
||||
DEVICE_GEODATA_IOS_SILENT_PUSH_AGE,
|
||||
// DEVICE_GEODATA_IOS_SILENT_PUSH_AGE,
|
||||
DEVICE_GEODATA_NOTIFICATION_AGE,
|
||||
DEVICE_GEODATA_CLEANUP_AGE,
|
||||
} = require("~/constants/time")
|
||||
|
@ -15,9 +15,7 @@ const COLDGEODATA_DEVICE_KEY_PREFIX = "device:geodata:"
|
|||
const COLDGEODATA_OLD_KEY_PREFIX = "old:device:geodata:"
|
||||
const COLDGEODATA_NOTIFIED_KEY_PREFIX = "notified:device:geodata:"
|
||||
const HOTGEODATA_KEY = "device" // The key where hot geodata is stored
|
||||
const iosHeartbeatAge = Math.floor(
|
||||
ms(DEVICE_GEODATA_IOS_SILENT_PUSH_AGE) / 1000
|
||||
) // Convert to seconds
|
||||
// const iosHeartbeatAge = Math.floor(ms(DEVICE_GEODATA_IOS_SILENT_PUSH_AGE) / 1000)
|
||||
const notificationAge = Math.floor(ms(DEVICE_GEODATA_NOTIFICATION_AGE) / 1000) // Convert to seconds
|
||||
const cleanupAge = Math.floor(ms(DEVICE_GEODATA_CLEANUP_AGE) / 1000) // Convert to seconds
|
||||
|
||||
|
@ -93,22 +91,22 @@ module.exports = async function () {
|
|||
"Error cleaning device data"
|
||||
)
|
||||
}
|
||||
} else if (age > iosHeartbeatAge) {
|
||||
try {
|
||||
await addTask(tasks.IOS_GEOLOCATION_HEARTBEAT_SYNC, {
|
||||
deviceId,
|
||||
})
|
||||
// } else if (age > iosHeartbeatAge) {
|
||||
// try {
|
||||
// await addTask(tasks.IOS_GEOLOCATION_HEARTBEAT_SYNC, {
|
||||
// deviceId,
|
||||
// })
|
||||
|
||||
logger.info(
|
||||
{ deviceId, age: `${Math.floor(age / 3600)}h` },
|
||||
"Enqueued iOS geolocation heartbeat sync task"
|
||||
)
|
||||
} catch (heartbeatError) {
|
||||
logger.error(
|
||||
{ deviceId, error: heartbeatError },
|
||||
"Error enqueueing iOS geolocation heartbeat sync task"
|
||||
)
|
||||
}
|
||||
// logger.info(
|
||||
// { deviceId, age: `${Math.floor(age / 3600)}h` },
|
||||
// "Enqueued iOS geolocation heartbeat sync task"
|
||||
// )
|
||||
// } catch (heartbeatError) {
|
||||
// logger.error(
|
||||
// { deviceId, error: heartbeatError },
|
||||
// "Error enqueueing iOS geolocation heartbeat sync task"
|
||||
// )
|
||||
// }
|
||||
} else if (age > notificationAge) {
|
||||
const notifiedKey = `${COLDGEODATA_NOTIFIED_KEY_PREFIX}${deviceId}`
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue