pushes on tangled sites.wisp.place/zzstoatzz.io/punch
fun tangled
7
fork

Configure Feed

Select the types of activity you want to include in your feed.

updatedAt reflects last cron cycle, not request time

previous fix made every request return updatedAt=now, which always
rendered as "just now" in the UI regardless of actual data
freshness. pulling from meta.last_published_at (set at end of each
cron tick) means the clock advances in ~10 min jumps matching cron
cadence, which is what a "last updated" timestamp should show.

Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>

+12 -5
+12 -5
worker/src/render.ts
··· 28 28 const knotRows = await env.DB.prepare("SELECT host FROM knots").all<{ host: string }>(); 29 29 const knots = knotRows.results.map((r) => r.host).sort(); 30 30 31 - const totalRow = await env.DB.prepare( 32 - "SELECT value FROM meta WHERE key = 'seen_ref_updates'", 33 - ).first<{ value: string }>(); 34 - const totalPushes = Number(totalRow?.value ?? 0); 31 + const meta = await env.DB.prepare( 32 + "SELECT key, value FROM meta WHERE key IN ('seen_ref_updates', 'last_published_at')", 33 + ).all<{ key: string; value: string }>(); 34 + const metaMap = new Map(meta.results.map((r) => [r.key, r.value])); 35 + const totalPushes = Number(metaMap.get("seen_ref_updates") ?? 0); 36 + 37 + // updatedAt tracks when the DATA was last refreshed (end of last cron tick), 38 + // not when this JSON was serialized. fall back to now only if no cycle has 39 + // run yet. 40 + const lastCycle = metaMap.get("last_published_at"); 41 + const updatedAt = lastCycle && lastCycle.length > 0 ? lastCycle : new Date().toISOString(); 35 42 36 43 return { 37 44 rows, 38 - updatedAt: new Date().toISOString(), 45 + updatedAt, 39 46 knots, 40 47 totalPushes, 41 48 status,