fix: cap Prisma pool during next build to stop deploy SSG timeouts

Next build workers were each opening up to DATABASE_POOL_SIZE connections and exhausting MySQL (pool active=0), hanging sitemap generation. Cap build pool to 5, fail connect faster, limit SSG concurrency, and make sitemap dynamic.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-21 21:28:27 +02:00
1 parent 803e8f36c1
commit 77931db775
5 files changed
+53 -3

No files matched your search

+19
View File
@@ -0,0 +1,19 @@
import { describe, expect, it } from "vitest";
import { resolvePrismaConnectionLimit } from "./prisma-pool";
describe("resolvePrismaConnectionLimit", () => {
it("caps the pool during production build phases", () => {
expect(resolvePrismaConnectionLimit(40, "phase-production-build")).toBe(5);
expect(
resolvePrismaConnectionLimit(40, "phase-production-compile"),
).toBe(5);
expect(resolvePrismaConnectionLimit(3, "phase-production-build")).toBe(3);
});
it("keeps the configured pool outside build", () => {
expect(resolvePrismaConnectionLimit(40, undefined)).toBe(40);
expect(resolvePrismaConnectionLimit(40, "phase-development-server")).toBe(
40,
);
});
});