music: 30-min per-request idle timeout for reindex/manifest (from-scratch builds)
A from-scratch rebuild holds the triggering request open for many minutes with no bytes flowing, so both server hops' idle timeouts would drop it. Bun caps the server-level idleTimeout at 255s, but server.timeout(req, seconds) allows more per-request: - sidecar Bun.serve: extend /reindex, /manifest, /reindex/stream to 1800s. - platform proxy (music router): same, via the Bun server exposed as Hono's env. Baseline idleTimeouts unchanged (sidecar 255, main server 60). The build always completed in the background regardless; this keeps the request itself alive. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -90,6 +90,18 @@ musicRouter.all('/*', async (ctx) => {
|
||||
const subpath = url.pathname.slice(PREFIX.length) || '/';
|
||||
const target = `${baseUrl}${subpath}${url.search}`;
|
||||
|
||||
// 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') {
|
||||
const server = ctx.env as { timeout?: (req: Request, seconds: number) => void } | undefined;
|
||||
try {
|
||||
server?.timeout?.(ctx.req.raw, 1800);
|
||||
} catch {
|
||||
/* older Bun / no per-request timeout — the build still completes in the background */
|
||||
}
|
||||
}
|
||||
|
||||
const range = ctx.req.header('range');
|
||||
let upstream: Response;
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user