Files
EpicNext-Cms/src/lib/prisma-pool.ts
T
SimoandCursor 77931db775
Deploy / release (push) Skipped
Deploy / deploy (push) Successful in 1m28s
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]>
2026-07-21 21:28:27 +02:00

17 lines
421 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Cap pool size during `next build` so N workers × pool don't exhaust MySQL.
* Kept free of Prisma/env imports so unit tests can exercise it in isolation.
*/
export function resolvePrismaConnectionLimit(
poolSize: number,
phase = process.env.NEXT_PHASE,
): number {
if (
phase === "phase-production-build" ||
phase === "phase-production-compile"
) {
return Math.min(poolSize, 5);
}
return poolSize;
}