mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-24 16:12:23 +03:00
Merged via merge-train (release/v3.8.50, batch1 2026-08-20) — static gates (typecheck/file-size/complexity/cognitive/changelog) green on the combined tree; test:unit reds observed in the boarded run were verified pre-existing on the pure release tip (unrelated flake), not caused by this PR. Thanks for the contribution!
This commit is contained in:
19
src/proxy.ts
19
src/proxy.ts
@@ -1,6 +1,25 @@
|
||||
import type { NextRequest } from "next/server";
|
||||
import { runAuthzPipeline } from "./server/authz/pipeline";
|
||||
|
||||
// #10627: the proxy runs in its own Next.js runtime and never executes
|
||||
// instrumentation-node.ts's startup warm-ups, so its FIRST request used to
|
||||
// trigger a cold `import("@/lib/db/settings")` → native SQLite driver load ON
|
||||
// the request path. If that addon hangs (see driverFactory's #10627 probe),
|
||||
// every proxied request stalled indefinitely with 0 bytes and no logs.
|
||||
// Warm the settings cache here at boot instead: a driver failure now surfaces
|
||||
// as a logged startup error, and real requests start with a hot cache.
|
||||
// Fire-and-forget — never blocks proxy initialization, never rejects the
|
||||
// module (mirrors the `void warmModelCatalogCache()` pattern in
|
||||
// instrumentation-node.ts).
|
||||
void import("./lib/db/readCache")
|
||||
.then(({ getCachedSettings }) => getCachedSettings())
|
||||
.catch((err: unknown) => {
|
||||
console.error(
|
||||
"[proxy] DB settings warm failed; requests will use default limits:",
|
||||
err instanceof Error ? err.message : err
|
||||
);
|
||||
});
|
||||
|
||||
export async function proxy(request: NextRequest) {
|
||||
return runAuthzPipeline(request, { enforce: true });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user