Skip to content

Commit

Permalink
Set idleTimeoutMillis to 120 seconds
Browse files Browse the repository at this point in the history
  • Loading branch information
codicocodes committed Feb 6, 2024
1 parent 271c9e2 commit 445f14f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 7 additions & 1 deletion packages/back-nest/src/config/postgres.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import * as dotenv from 'dotenv';
import { PostgresConnectionOptions } from 'typeorm/driver/postgres/PostgresConnectionOptions';
dotenv.config({ path: __dirname + '/../../.env' });

export const pgOptions = {
export const pgOptions: Partial<PostgresConnectionOptions> = {
host: process.env.PGHOST,
port: parseInt(process.env.PGPORT, 10),
username: process.env.PGUSER,
password: process.env.PGPASSWORD,
database: process.env.PGDATABASE,
extra: {
// 120 seconds idle timeout
idleTimeoutMillis: 120000,
max: 10,
},
};
1 change: 0 additions & 1 deletion packages/back-nest/src/database.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { pgOptions } from './config/postgres';
const entities = [__dirname + '/**/*.entity.{ts,js}'];

export const PostgresDataSource = new DataSource({
extra: { min: 0, max: 10 },
type: 'postgres',
synchronize: true,
entities,
Expand Down

0 comments on commit 445f14f

Please sign in to comment.