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

This commit is contained in:
Jo 2025-08-02 15:38:33 +02:00
parent 42cddb2aa2
commit 9920f40268
Signed by: devthejo
GPG key ID: 00CCA7A92B1D5351
5 changed files with 23 additions and 25 deletions

View file

@ -9,8 +9,8 @@ function createBackgroundGeolocationLostNotification() {
action: "background-geolocation-lost", action: "background-geolocation-lost",
}, },
notification: { notification: {
title: `Alerte-Secours ne peut plus accéder à votre position`, title: `Alerte-Secours ne reçoit plus de mises à jour de votre position`,
body: `Vous ne pouvez plus recevoir d'alertes de proximité. Vérifiez les paramètres.`, body: `Vous ne pourrez plus recevoir d'alertes de proximité. Vérifiez les paramètres.`,
channel: "system", channel: "system",
priority: "high", priority: "high",
actionId: "open-background-geolocation-settings", actionId: "open-background-geolocation-settings",

View file

@ -8,9 +8,9 @@ module.exports = {
SCAN_AUTO_CLOSE_CRON: "15 * * * *", // At minute 15 SCAN_AUTO_CLOSE_CRON: "15 * * * *", // At minute 15
SCAN_AUTO_ARCHIVE_CRON: "0 4 * * *", // At 4:00 SCAN_AUTO_ARCHIVE_CRON: "0 4 * * *", // At 4:00
RELATIVE_UNREGISTERED_RECONCILIATION_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_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_NOTIFICATION_AGE: "14 days", // When to send push notification
DEVICE_GEODATA_CLEANUP_AGE: "2 weeks", // When to remove/clean data DEVICE_GEODATA_CLEANUP_AGE: "15 days", // When to remove/clean data
} }
// cheat on https://crontab.guru/ // cheat on https://crontab.guru/

View file

@ -10,5 +10,5 @@ module.exports = {
RELATIVE_INVITATION_NOTIFY: "relativeInvitationNotify", RELATIVE_INVITATION_NOTIFY: "relativeInvitationNotify",
ALERT_CALL_EMERGENCY_INFO_NOTIFY: "alertCallEmergencyInfoNotify", ALERT_CALL_EMERGENCY_INFO_NOTIFY: "alertCallEmergencyInfoNotify",
BACKGROUND_GEOLOCATION_LOST_NOTIFY: "backgroundGeolocationLostNotify", BACKGROUND_GEOLOCATION_LOST_NOTIFY: "backgroundGeolocationLostNotify",
IOS_GEOLOCATION_HEARTBEAT_SYNC: "iosGeolocationHeartbeatSync", // IOS_GEOLOCATION_HEARTBEAT_SYNC: "iosGeolocationHeartbeatSync",
} }

View file

@ -3,7 +3,7 @@ const { ctx } = require("@modjo/core")
const ms = require("ms") const ms = require("ms")
const cron = require("~/libs/cron") const cron = require("~/libs/cron")
const { const {
DEVICE_GEODATA_IOS_SILENT_PUSH_AGE, // DEVICE_GEODATA_IOS_SILENT_PUSH_AGE,
DEVICE_GEODATA_NOTIFICATION_AGE, DEVICE_GEODATA_NOTIFICATION_AGE,
DEVICE_GEODATA_CLEANUP_AGE, DEVICE_GEODATA_CLEANUP_AGE,
} = require("~/constants/time") } = require("~/constants/time")
@ -15,9 +15,7 @@ const COLDGEODATA_DEVICE_KEY_PREFIX = "device:geodata:"
const COLDGEODATA_OLD_KEY_PREFIX = "old:device:geodata:" const COLDGEODATA_OLD_KEY_PREFIX = "old:device:geodata:"
const COLDGEODATA_NOTIFIED_KEY_PREFIX = "notified:device:geodata:" const COLDGEODATA_NOTIFIED_KEY_PREFIX = "notified:device:geodata:"
const HOTGEODATA_KEY = "device" // The key where hot geodata is stored const HOTGEODATA_KEY = "device" // The key where hot geodata is stored
const iosHeartbeatAge = Math.floor( // const iosHeartbeatAge = Math.floor(ms(DEVICE_GEODATA_IOS_SILENT_PUSH_AGE) / 1000)
ms(DEVICE_GEODATA_IOS_SILENT_PUSH_AGE) / 1000
) // Convert to seconds
const notificationAge = Math.floor(ms(DEVICE_GEODATA_NOTIFICATION_AGE) / 1000) // Convert to seconds 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 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" "Error cleaning device data"
) )
} }
} else if (age > iosHeartbeatAge) { // } else if (age > iosHeartbeatAge) {
try { // try {
await addTask(tasks.IOS_GEOLOCATION_HEARTBEAT_SYNC, { // await addTask(tasks.IOS_GEOLOCATION_HEARTBEAT_SYNC, {
deviceId, // deviceId,
}) // })
logger.info( // logger.info(
{ deviceId, age: `${Math.floor(age / 3600)}h` }, // { deviceId, age: `${Math.floor(age / 3600)}h` },
"Enqueued iOS geolocation heartbeat sync task" // "Enqueued iOS geolocation heartbeat sync task"
) // )
} catch (heartbeatError) { // } catch (heartbeatError) {
logger.error( // logger.error(
{ deviceId, error: heartbeatError }, // { deviceId, error: heartbeatError },
"Error enqueueing iOS geolocation heartbeat sync task" // "Error enqueueing iOS geolocation heartbeat sync task"
) // )
} // }
} else if (age > notificationAge) { } else if (age > notificationAge) {
const notifiedKey = `${COLDGEODATA_NOTIFIED_KEY_PREFIX}${deviceId}` const notifiedKey = `${COLDGEODATA_NOTIFIED_KEY_PREFIX}${deviceId}`