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
10 lines
468 B
TypeScript
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 }) }) });
|
|
}
|