GET /xrpc/app.bsky.actor.searchActorsTypeahead typeahead.waow.tech
15
fork

Configure Feed

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

fix stats page browser caching: no-store for browser, edge-only cache

CF's zone-level Browser Cache TTL was overriding our max-age=60 to
max-age=14400 (4 hours), causing stale stats in browsers. split cache
strategy: Cache API entry uses max-age=60 for edge TTL, browser gets
no-store so refreshes always revalidate through the edge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

zzstoatzz b0ff2e52 10c99fe0

+17 -7
+17 -7
src/handlers/stats.ts
··· 9 9 const cache = caches.default; 10 10 const cacheKey = new Request(new URL("/stats", request.url).href); 11 11 const cached = await cache.match(cacheKey); 12 - if (cached) return cached; 12 + if (cached) { 13 + // override cache-control so browser doesn't cache the cached response 14 + const resp = new Response(cached.body, cached); 15 + resp.headers.set("Cache-Control", "no-store"); 16 + return resp; 17 + } 13 18 14 19 const t0 = performance.now(); 15 20 ··· 91 96 const renderMs = (tRender - tProcess).toFixed(0); 92 97 const totalMs2 = (tRender - t0).toFixed(0); 93 98 94 - const response = html(body, { 95 - "Server-Timing": `query;dur=${queryMs}, process;dur=${processMs}, render;dur=${renderMs}, total;dur=${totalMs2}`, 99 + const timing = `query;dur=${queryMs}, process;dur=${processMs}, render;dur=${renderMs}, total;dur=${totalMs2}`; 100 + 101 + // edge cache entry — public, max-age controls the Cache API TTL 102 + const cacheResponse = html(body, { 103 + "Server-Timing": timing, 96 104 "Cache-Control": `public, max-age=${EDGE_CACHE_TTL}`, 97 105 }); 106 + ctx.waitUntil(cache.put(cacheKey, cacheResponse)); 98 107 99 - // populate edge cache — use waitUntil so it completes after response is sent 100 - ctx.waitUntil(cache.put(cacheKey, response.clone())); 101 - 102 - return response; 108 + // browser response — no caching so refreshes always get fresh data 109 + return html(body, { 110 + "Server-Timing": timing, 111 + "Cache-Control": "no-store", 112 + }); 103 113 }