← back to Stars of Design
sod-comments-cache
4682babc57490c18e62c54ca38c5e5fa921d876e · 2026-05-12 23:56:21 -0700 · Steve Abrams
Files touched
Diff
commit 4682babc57490c18e62c54ca38c5e5fa921d876e
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue May 12 23:56:21 2026 -0700
sod-comments-cache
---
routes/public.js | 3 +++
1 file changed, 3 insertions(+)
diff --git a/routes/public.js b/routes/public.js
index 787fb09..7ea964c 100644
--- a/routes/public.js
+++ b/routes/public.js
@@ -344,6 +344,9 @@ router.get('/api/clients/:id/comments', async (req, res, next) => {
const id = parseInt(req.params.id, 10);
if (!Number.isFinite(id) || id < 1) return res.status(400).json({ error: 'bad-id' });
const rows = await feedLib.commentsFor(id, 100);
+ // 30s Cache-Control — comments can move quickly during active threads.
+ // SWR lets a stale list render while the refresh fires in the background.
+ res.setHeader('Cache-Control', 'public, max-age=30, stale-while-revalidate=60');
res.json({ comments: rows });
} catch (e) { next(e); }
});
← 571d289 sod-cache-stats
·
back to Stars of Design
·
sodhz 0160b3c →