draw things doodl.waow.tech
draw atproto
0

Configure Feed

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

share worker: fetch the remix count fresh, never edge-cached

a short ttl still let a stale backlinks entry linger; the count is cheap, so
fetch it uncached (getJsonFresh) and it reflects new remixes immediately.
immutable record/identity/blob fetches still cache hard.

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

+12 -7
+12 -7
worker/share.js
··· 16 16 // would otherwise return index.html here and break verification). 17 17 const HANDLE_DID = "did:plc:6ovtwazlv3puzj4aqai52xgc"; 18 18 19 - // immutable data (records/identity/blobs are content-addressed) caches hard; 20 - // dynamic data (the remix backlink count) passes a short ttl so new remixes 21 - // surface promptly instead of being frozen for the page's whole cache window. 22 - async function getJson(u, ttl = 300) { 23 - const r = await fetch(u, { cf: { cacheTtl: ttl, cacheEverything: true } }); 19 + // immutable data (records/identity/blobs are content-addressed) caches hard. 20 + async function getJson(u) { 21 + const r = await fetch(u, { cf: { cacheTtl: 300, cacheEverything: true } }); 22 + if (!r.ok) throw new Error(`${r.status} ${u}`); 23 + return r.json(); 24 + } 25 + 26 + // dynamic data (the remix backlink count) — fetched fresh, never edge-cached, 27 + // so a new remix shows up immediately instead of being frozen for minutes. 28 + async function getJsonFresh(u) { 29 + const r = await fetch(u, { cf: { cacheTtl: 0, cacheEverything: false } }); 24 30 if (!r.ok) throw new Error(`${r.status} ${u}`); 25 31 return r.json(); 26 32 } ··· 45 51 // the detail page can show + LINK to the actual remixes, not just a count. 46 52 async function resolveRemixes(uri, limit = 12) { 47 53 try { 48 - const r = await getJson( 54 + const r = await getJsonFresh( 49 55 `${CONSTELLATION}/xrpc/blue.microcosm.links.getBacklinks` + 50 56 `?subject=${encodeURIComponent(uri)}&source=${COLLECTION}:parent.uri&limit=${limit}`, 51 - 15, // short ttl: surface new remixes within seconds, not 5 minutes 52 57 ); 53 58 const total = r?.total || 0; 54 59 const items = await Promise.all(