|
|
|
@ -1,5 +1,6 @@ |
|
|
|
import pg from "pg"; |
|
|
|
|
|
|
|
export async function getClient() { |
|
|
|
// Create a connection pool instead of individual connections
|
|
|
|
const pool = new pg.Pool({ |
|
|
|
user: process.env.POSTGRES_USER, |
|
|
|
@ -13,7 +14,7 @@ const pool = new pg.Pool({ |
|
|
|
acquireTimeoutMillis: 10000, // Wait up to 10 seconds for a connection
|
|
|
|
}); |
|
|
|
|
|
|
|
export async function getClient() { |
|
|
|
|
|
|
|
// Use pool.connect() instead of creating new clients
|
|
|
|
return await pool.connect(); |
|
|
|
} |
|
|
|
|