From f615387b62ff7edb6422a419bce50ea1c9568132 Mon Sep 17 00:00:00 2001 From: Otto Paaso Date: Mon, 14 May 2018 16:05:22 +0300 Subject: [PATCH 1/2] Add keepAlive configuration option Introduced to pg in https://github.com/brianc/node-postgres/pull/1058 --- types/pg/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 7437976d44..ffb2379a7c 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -16,6 +16,7 @@ export interface ConnectionConfig { port?: number; host?: string; connectionString?: string; + keepAlive?: boolean; } export interface Defaults extends ConnectionConfig { From 7ad5c037366a4fd03ced4d9cf605804a7233ac8f Mon Sep 17 00:00:00 2001 From: Otto Paaso Date: Mon, 14 May 2018 16:15:14 +0300 Subject: [PATCH 2/2] Use keepAlive config in tests --- types/pg/pg-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index ae60f1bb6f..5051447667 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -9,6 +9,7 @@ const client = new Client({ port: 5334, user: 'database-user', password: 'secretpassword!!', + keepAlive: true, }); client.connect(err => { if (err) { @@ -125,6 +126,7 @@ const pool = new Pool({ max: 20, idleTimeoutMillis: 30000, connectionTimeoutMillis: 2000, + keepAlive: false, }); console.log(pool.totalCount); pool.connect((err, client, done) => {