[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
This commit is contained in:
Kristina
2026-09-17 11:25:41 +00:00
committed by Copybot
parent 7fe05140b0
commit 8741846df8
2 changed files with 6 additions and 0 deletions
@@ -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'
)
},
@@ -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++