diff --git a/services/document-updater/app/js/RedisManager.js b/services/document-updater/app/js/RedisManager.js index 7011de6b4d..a5c56c4904 100644 --- a/services/document-updater/app/js/RedisManager.js +++ b/services/document-updater/app/js/RedisManager.js @@ -16,6 +16,7 @@ const rclient = RedisWrapper.createClient(Settings.redis.documentupdater) // hold us up, and need to bail out quickly if there is a problem. const MAX_REDIS_REQUEST_LENGTH = 5000 // 5 seconds const PROJECT_BLOCK_TTL_SECS = 30 +const ONE_DAY_SECS = 24 * 60 * 60 // Make times easy to read const minutes = 60 // seconds for Redis expire @@ -575,6 +576,8 @@ const RedisManager = { await rclient.set( keys.projectNotificationTimestamp({ project_id: projectId }), timestamp, + 'EX', + 7 * ONE_DAY_SECS, 'NX' ) }, diff --git a/services/document-updater/scripts/project_notifications.mts b/services/document-updater/scripts/project_notifications.mts index 0791551ef7..e25e1ae7dd 100644 --- a/services/document-updater/scripts/project_notifications.mts +++ b/services/document-updater/scripts/project_notifications.mts @@ -384,6 +384,9 @@ async function getProjectsToNotify(): Promise<{ for (const c of candidates) { if (!projectsWithCollaborators.has(c.projectId)) { stats.skippedNoCollaborators++ + if (!dryRun) { + await deleteProjectNotificationTimestamp(c.projectId, c.timestamp) + } continue } stats.matched++