music: /manifest is a pure read — never triggers a (re)build

Reading the manifest (which every app refresh hits) used to call
ensureIndexFresh(), kicking off a debounced rebuild — and after the CACHE_VERSION
bump that meant a plain refresh could launch a full library rebuild. Make reads
side-effect-free: /manifest now just returns the last completed index. Builds are
explicit only (POST /reindex or the SSE stream); pick up disk changes by
reindexing.

Removes the now-unused ensureIndexFresh + lastBuildFinishedAt, and drops
/manifest from the 30-min per-request timeout extension (both hops) since it no
longer blocks on a build.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-27 16:07:39 +00:00
co-authored by Claude Opus 4.8
parent 48d24544f3
commit b84f0b0b18
3 changed files with 14 additions and 34 deletions
+1 -1
View File
@@ -93,7 +93,7 @@ musicRouter.all('/*', async (ctx) => {
// A from-scratch reindex holds this proxied connection open for minutes with no bytes flowing, which
// the main server's 60s idle timeout would drop. Extend it to 30 min for the build/progress endpoints
// (Bun passes the server as Hono's env). Matches the sidecar's own per-request extension.
if (subpath === '/reindex' || subpath === '/manifest' || subpath === '/reindex/stream') {
if (subpath === '/reindex' || subpath === '/reindex/stream') {
const server = ctx.env as { timeout?: (req: Request, seconds: number) => void } | undefined;
try {
server?.timeout?.(ctx.req.raw, 1800);