Skip to content

Cache or index the public live link item lookup #1072

Description

@zachdunn

Public live link item pages (/c/<id>/<item>) find an item by scanning the live link's scope and hashing each key until one matches the item id. They do this through GET /public/feeds/:id/items/:item, implemented in publicFeedItemPage in apps/api/src/feed-service.ts. The public cursor for GET /public/feeds/:id?cursor= does the same lookup at its page boundary.

The scan can read up to 2,000 rows and run up to 2,000 SHA-256 digests on each request. Nothing is cached, and no sign-in is needed. PR comments now link every file in scope to its item page, so this path gets hit more.

Options:

  • Cache the scope's id-to-key list for each live link for a short TTL, using the Cache API or KV.
  • Store the item id as a server-owned file_metadata row when the file is written, and look it up through an index.
  • Rate-limit the public item endpoint.

Found in review of the live link paging work (#1069).

Activity

  1. zachdunn commented on Oct 5, 2026

    @zachdunn
    MemberAuthor

    Reopening: the Cache API list from #1083 never produced a hit for /c/ pages, which reach the API over the web Worker's service binding. Direct requests to the API did hit. Moving the list to KV so it works on both paths.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions