Repository navigation
perf(api): keep the live link item list in KV instead of the Cache API - #1087
Conversation
Public item pages reach the API through the web Worker's service binding, where Cache API writes never produced a hit. The hashed scope list now lives in a dedicated LIVE_LINK_INDEX KV namespace with a 60 s TTL, with the same D1 checks before any cached entry is used. Each lookup logs its outcome (hit, absent, stale, newer, miss, unbound).
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (2)
🚫 Excluded labels (none allowed) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-api | 5aa68c8 | Commit Preview URL Branch Preview URL |
Oct 05 2026, 12:37 PM |
The item list cache from #1083 used the Workers Cache API. Public item pages (
/c/<id>/<item>) reach the API through the web Worker'sAPIservice binding, and on that path the cache never produced a hit. Requests sent straight toapi.uploads.shdid hit. Every real item page view still scanned and hashed the whole scope.Changes
live-link-index.tsstores each live link's hashed scope list in a newLIVE_LINK_INDEXKV namespace with a 60 sexpirationTtl(KV's minimum). The rest of the design is unchanged: a cached entry is used only afterscopeHasKeyconfirms the key is still in scope, an id missing from the list costs one bounded query for newer rows, and a revoked link 404s before the lookup runs.UPLOADS_LIVE_LINK_INDEX,UPLOADS_LIVE_LINK_INDEX_PREVIEW), already created. The list holds object keys, so it is not shared the wayGITHUB_CACHEis.publicFeedItemPage, so the MCP Worker, which importsfeed-service.tswithout this binding, still type-checks and simply scans.{"message":"live_link_index","outcome":...}, withhit,absent,stale,newer,miss, orunbound, so cache behaviour shows in Workers Logs.Testing
pnpm checkpass.After deploy, check Workers Logs for
live_link_indexlines withoutcome: "hit"on/c/page views.Closes #1072