From 51b9718fa38a7775458bfe6d10acbf5d57308fc1 Mon Sep 17 00:00:00 2001 From: Sone Date: Sun, 24 May 2026 21:41:20 +0200 Subject: [PATCH] optimization --- src/index.ts | 4 ++-- src/prismaClient.ts | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/index.ts b/src/index.ts index 00e0e74..1c1b836 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,10 +15,10 @@ app.use( methods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"], allowedHeaders: ["Content-Type", "Authorization"], credentials: true, - }) + maxAge: 3600, + }), ); - app.use(express.json()); app.use("/api/auth", authRoutes); diff --git a/src/prismaClient.ts b/src/prismaClient.ts index 64d06b2..1efadef 100644 --- a/src/prismaClient.ts +++ b/src/prismaClient.ts @@ -2,7 +2,12 @@ import { PrismaClient } from "@prisma/client"; import { PrismaPg } from "@prisma/adapter-pg"; import pg from "pg"; -const pool = new pg.Pool({ connectionString: process.env.DATABASE_URL }); +const pool = new pg.Pool({ + connectionString: process.env.DATABASE_URL, + max: 10, + idleTimeoutMillis: 30000, + connectionTimeoutMillis: 5000, +}); const adapter = new PrismaPg(pool, { schema: "Athena" }); const prisma = new PrismaClient({ adapter });