fix(cleanup): increase time
All checks were successful
/ build (map[dockerfile:./services/web/Dockerfile name:web]) (push) Successful in 2m29s
/ build (map[dockerfile:./services/files/Dockerfile name:files]) (push) Successful in 2m16s
/ build (map[dockerfile:./services/app/Dockerfile name:app]) (push) Successful in 2m41s
/ build (map[dockerfile:./services/tasks/Dockerfile name:tasks]) (push) Successful in 2m30s
/ build (map[dockerfile:./services/api/Dockerfile name:api]) (push) Successful in 2m15s
/ build (map[dockerfile:./services/hasura/Dockerfile name:hasura]) (push) Successful in 2m39s
/ build (map[dockerfile:./services/watchers/Dockerfile name:watchers]) (push) Successful in 2m38s
/ deploy (push) Successful in 20s

This commit is contained in:
Jo 2025-07-27 09:02:06 +02:00
parent 5a5a49634a
commit a80a5aaa00
Signed by: devthejo
GPG key ID: 00CCA7A92B1D5351
2 changed files with 4 additions and 10 deletions

View file

@ -9,8 +9,8 @@ module.exports = {
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: "36 hours", // When to send push notification DEVICE_GEODATA_NOTIFICATION_AGE: "48 hours", // When to send push notification
DEVICE_GEODATA_CLEANUP_AGE: "48 hours", // When to remove/clean data DEVICE_GEODATA_CLEANUP_AGE: "2 weeks", // When to remove/clean data
} }
// cheat on https://crontab.guru/ // cheat on https://crontab.guru/

View file

@ -69,7 +69,6 @@ module.exports = async function () {
const data = JSON.parse(deviceData) const data = JSON.parse(deviceData)
const age = data.updatedAt ? now - data.updatedAt : Infinity const age = data.updatedAt ? now - data.updatedAt : Infinity
// Handle cleanup first (48h+) - this takes priority
if (age > cleanupAge) { if (age > cleanupAge) {
try { try {
// Remove from hot storage // Remove from hot storage
@ -94,11 +93,8 @@ module.exports = async function () {
"Error cleaning device data" "Error cleaning device data"
) )
} }
} } else if (age > iosHeartbeatAge) {
// Handle iOS silent push for heartbeat sync (24h+ but less than 36h)
else if (age > iosHeartbeatAge) {
try { try {
// Enqueue task to send iOS silent push for geolocation heartbeat sync
await addTask(tasks.IOS_GEOLOCATION_HEARTBEAT_SYNC, { await addTask(tasks.IOS_GEOLOCATION_HEARTBEAT_SYNC, {
deviceId, deviceId,
}) })
@ -113,9 +109,7 @@ module.exports = async function () {
"Error enqueueing iOS geolocation heartbeat sync task" "Error enqueueing iOS geolocation heartbeat sync task"
) )
} }
} } else if (age > notificationAge) {
// Handle notification (36h+ but less than 48h) - only during 9-19h window
else if (age > notificationAge) {
const notifiedKey = `${COLDGEODATA_NOTIFIED_KEY_PREFIX}${deviceId}` const notifiedKey = `${COLDGEODATA_NOTIFIED_KEY_PREFIX}${deviceId}`
try { try {