From 58576dd4ab2e45c18e3cedaf0bf519fe3faaa72c Mon Sep 17 00:00:00 2001 From: Edouard Benauw Date: Sun, 9 Apr 2023 22:07:16 +0200 Subject: [PATCH] fix(postgres): prevent crash if postgres connection emits multiple errors (#15868) --- src/dialects/postgres/connection-manager.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/dialects/postgres/connection-manager.js b/src/dialects/postgres/connection-manager.js index 6b8f30a0b7b1..2b1bf6894f23 100644 --- a/src/dialects/postgres/connection-manager.js +++ b/src/dialects/postgres/connection-manager.js @@ -203,7 +203,7 @@ class ConnectionManager extends AbstractConnectionManager { }); // Don't let a Postgres restart (or error) to take down the whole app - connection.once('error', error => { + connection.on('error', error => { connection._invalid = true; debug(`connection error ${error.code || error.message}`); this.pool.destroy(connection);