From 8741846df86966d6ada3bb664462c8220b48423a Mon Sep 17 00:00:00 2001 From: Kristina <7614497+khjrtbrg@users.noreply.github.com> Date: Tue, 14 Jul 2026 12:26:06 +0200 Subject: [PATCH] [doc-updater] fix unbounded Redis key growth in project notifications cron (#35425) * delete timestamp notification keys for solo projects * add fallback 7d TTL for keys GitOrigin-RevId: e0493e74b14b861863afc1d4ef5fa181432ad450 --- services/document-updater/app/js/RedisManager.js | 3 +++ services/document-updater/scripts/project_notifications.mts | 3 +++ 2 files changed, 6 insertions(+) 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++