get postgres connection pool size from env

This commit is contained in:
Hongbo Wu
2024-02-20 18:08:55 +08:00
parent 03c4adc930
commit 942b2374b8

View File

@ -16,9 +16,11 @@ export const appDataSource = new DataSource({
subscribers: [__dirname + '/events/**/*{.js,.ts}'],
namingStrategy: new SnakeNamingStrategy(),
logger: new CustomTypeOrmLogger(['query', 'info']),
connectTimeoutMS: 40000, // 40 seconds
connectTimeoutMS: 10000, // 10 seconds
maxQueryExecutionTime: 10000, // 10 seconds
extra: {
options: process.env.PG_EXTRA_OPTIONS,
max: env.pg.pool.max,
idleTimeoutMillis: 10000, // 10 seconds
},
})