Files
photoreport/apps/api/src/db.ts
T
sparkandClaude Opus 5.5 ec3a974ac9
ci / rust (push) Successful in 17m47s
ci / typescript (push) Successful in 21m21s
Archive: burst mode for big backlogs (most of the machine until cleared), bigger pools
With more than 500 images waiting, the archive runs up to 75% of the cores and only
backs off near the memory limit or with tasks piling up; normal pace once cleared.
More face processes (they idle on memory only) and a worker DB pool sized to match.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HT6iXLYUUp9pJz5Kza9xCW
2026-10-14 18:19:19 +01:00

10 lines
468 B
TypeScript

import { PrismaPg } from "@prisma/adapter-pg";
import { PrismaClient } from "./generated/prisma/client.js";
export type Db = PrismaClient;
/** `connections`: the pool's size (node-postgres keeps 10 by default); the worker sizes it to what it runs at once. */
export function createDb(databaseUrl: string, connections?: number): Db {
return new PrismaClient({ adapter: new PrismaPg({ connectionString: databaseUrl, ...(connections && { max: connections }) }) });
}