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]>
20 lines
685 B
TypeScript
20 lines
685 B
TypeScript
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,
|
|
);
|
|
});
|
|
});
|