← back to AsSeenInMovies
asseeninmovies: home cache background refresh every 45s (unref-timer) so quiet periods never let the cache go stale. Eliminates the post-quiet cold-cache penalty.
0878efcf1ac2eead0245888bdab6cb8f031f4df7 · 2026-05-13 03:48:09 -0700 · SteveStudio2
Files touched
Diff
commit 0878efcf1ac2eead0245888bdab6cb8f031f4df7
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date: Wed May 13 03:48:09 2026 -0700
asseeninmovies: home cache background refresh every 45s (unref-timer) so quiet periods never let the cache go stale. Eliminates the post-quiet cold-cache penalty.
---
server.js | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/server.js b/server.js
index 503a9a2..1e77d60 100644
--- a/server.js
+++ b/server.js
@@ -1935,4 +1935,11 @@ app.listen(PORT, '127.0.0.1', async () => {
getHomeCache()
.then(d => console.log(`[home-cache] warm — movies=${d.stats.movies_total} people=${d.stats.people_total} spotted=${d.stats.spotted_total}`))
.catch(e => console.warn(`[home-cache] warmup failed: ${e.message}`));
+ // Keep the home cache fresh during quiet periods so the next-traffic
+ // burst doesn't hit cold count(*). 45s is below the 60s TTL so the
+ // cache never goes stale on a populated process. unref() lets the
+ // timer never block shutdown.
+ setInterval(() => {
+ startHomeRefresh().catch(() => {});
+ }, 45_000).unref();
});
← 4de56c1 asim-healthz
·
back to AsSeenInMovies
·
asseeninmovies: home cta-row — add SPOTTED browse-link along e810f9c →