From 93cbfdb3db27f591d758cf35b14b7d0ad861da0e Mon Sep 17 00:00:00 2001 From: 2ns2os <90063695+2ns2os@users.noreply.github.com> Date: Fri, 3 Sep 2021 14:59:40 -0400 Subject: [PATCH 1/2] Add 'query_timeout' to pg dialectOptions This option has existed in pg since v7.7 - see discussion at https://github.com/brianc/node-postgres/pull/1760 Adding to properties to be passed to new connection config so it can be used with sequelize --- lib/dialects/postgres/connection-manager.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/dialects/postgres/connection-manager.js b/lib/dialects/postgres/connection-manager.js index 0cf2f793743d..18f9aaf4d5a4 100644 --- a/lib/dialects/postgres/connection-manager.js +++ b/lib/dialects/postgres/connection-manager.js @@ -113,8 +113,10 @@ class ConnectionManager extends AbstractConnectionManager { // This should help with backends incorrectly considering idle clients to be dead and prematurely disconnecting them. // this feature has been added in pg module v6.0.0, check pg/CHANGELOG.md 'keepAlive', - // Times out queries after a set time in milliseconds. Added in pg v7.3 + // DB statement timeout in milliseconds. Added in pg v7.3 'statement_timeout', + // Client side request timeout in milliseconds. Added in pg v7.7 + 'query_timeout' // Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds. Added in pg v7.17.0 only supported in postgres >= 10 'idle_in_transaction_session_timeout' ])); From 32e98343b726ec442f6788a0935f61ccdc93e3f3 Mon Sep 17 00:00:00 2001 From: 2ns2os <90063695+2ns2os@users.noreply.github.com> Date: Tue, 7 Sep 2021 16:52:24 -0400 Subject: [PATCH 2/2] Update connection-manager.js missed comma --- lib/dialects/postgres/connection-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/dialects/postgres/connection-manager.js b/lib/dialects/postgres/connection-manager.js index 18f9aaf4d5a4..13e663cd510c 100644 --- a/lib/dialects/postgres/connection-manager.js +++ b/lib/dialects/postgres/connection-manager.js @@ -116,7 +116,7 @@ class ConnectionManager extends AbstractConnectionManager { // DB statement timeout in milliseconds. Added in pg v7.3 'statement_timeout', // Client side request timeout in milliseconds. Added in pg v7.7 - 'query_timeout' + 'query_timeout', // Terminate any session with an open transaction that has been idle for longer than the specified duration in milliseconds. Added in pg v7.17.0 only supported in postgres >= 10 'idle_in_transaction_session_timeout' ]));