Join the discussion on Telegram
Why this matters
backend/src/lib/redis.ts line 84:
setInterval(() => cache.cleanup(), 60000);
A bare unconfigurable 60-second sweep. Also runs even in tests (no clearInterval) which can leak timers across Vitest runs. Two small problems:
- No env knob.
- The interval is never cleared (so it survives module unload / test teardown). The
import is module-level so it leaks for the lifetime of the process.
Acceptance criteria
Files to touch
backend/src/lib/redis.ts (line 84)
Out of scope
- Swapping the in-memory cache for Redis caching of the same keys
Join the discussion on Telegram
Why this matters
backend/src/lib/redis.tsline 84:A bare unconfigurable 60-second sweep. Also runs even in tests (no clearInterval) which can leak timers across Vitest runs. Two small problems:
importis module-level so it leaks for the lifetime of the process.Acceptance criteria
process.env.MEMORY_CACHE_SWEEP_MSwith 60_000 defaultstopMemoryCacheSweep()function called from the test shutdown path (and fromdisconnectRedisfor symmetry).env.exampleFiles to touch
backend/src/lib/redis.ts(line 84)Out of scope