업데이트
This commit is contained in:
@@ -13,7 +13,7 @@ let pool: pg.Pool | null = null
|
||||
*/
|
||||
export function getPool(): pg.Pool {
|
||||
if (!pool) {
|
||||
pool = new Pool({
|
||||
const config = {
|
||||
host: process.env.DB_HOST || 'localhost',
|
||||
port: parseInt(process.env.DB_PORT || '5432'),
|
||||
database: process.env.DB_NAME || 'osolit_monitor',
|
||||
@@ -22,7 +22,11 @@ export function getPool(): pg.Pool {
|
||||
max: 10,
|
||||
idleTimeoutMillis: 30000,
|
||||
connectionTimeoutMillis: 2000,
|
||||
})
|
||||
}
|
||||
|
||||
console.log(`[DB] Connecting to ${config.host}:${config.port}/${config.database}`)
|
||||
|
||||
pool = new Pool(config)
|
||||
|
||||
pool.on('error', (err) => {
|
||||
console.error('[DB] Unexpected pool error:', err)
|
||||
|
||||
Reference in New Issue
Block a user