From 84111996b45e15391b7ed2fef8e81ae1ba3b7621 Mon Sep 17 00:00:00 2001 From: Girish Ramakrishnan Date: Thu, 19 Jun 2025 10:12:59 +0200 Subject: [PATCH] database: some debugs --- src/database.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/database.js b/src/database.js index d80cae27c..b4b669cec 100644 --- a/src/database.js +++ b/src/database.js @@ -57,6 +57,8 @@ async function initialize() { }); gConnectionPool.on('connection', function (connection) { + debug('connected'); + // connection objects are re-used. so we have to attach to the event here (once) to prevent crash // note the pool also has an 'acquire' event but that is called whenever we do a getConnection() connection.on('error', (error) => debug(`Connection ${connection.threadId} error: ${error.message} ${error.code}`)); @@ -74,6 +76,7 @@ async function uninitialize() { gConnectionPool.end(); gConnectionPool = null; + debug('connection closed'); } async function clear() { @@ -86,7 +89,7 @@ async function clear() { } async function query() { - assert.notStrictEqual(gConnectionPool, null); + assert.notStrictEqual(gConnectionPool, null, 'Database connection is already closed'); return new Promise((resolve, reject) => { const args = Array.prototype.slice.call(arguments);