Skip to content

Commit

Permalink
fix(connection): pick keepAlive dialectOption (#7927)
Browse files Browse the repository at this point in the history
  • Loading branch information
contactakagrawal authored and felixfbecker committed Jul 13, 2017
1 parent 5620834 commit 85ee83d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/dialects/postgres/connection-manager.js
Expand Up @@ -76,7 +76,10 @@ class ConnectionManager extends AbstractConnectionManager {
// !! DONT SET THIS TO TRUE !!
// (unless you know what you're doing)
// see [http://www.postgresql.org/message-id/flat/bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com#bc9549a50706040852u27633f41ib1e6b09f8339d845@mail.gmail.com]
'binary'
'binary',
// 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'
]));
}

Expand Down Expand Up @@ -149,7 +152,7 @@ class ConnectionManager extends AbstractConnectionManager {
if (dataTypes.HSTORE.types.postgres.oids.length === 0 && supportedVersion) {
query += 'SELECT typname, oid, typarray FROM pg_type WHERE typtype = \'b\' AND typname IN (\'hstore\', \'geometry\', \'geography\')';
}

return new Promise((resolve, reject) => {
connection.query(query)
.on('error', err => reject(err))
Expand Down

0 comments on commit 85ee83d

Please sign in to comment.