database: some debugs

This commit is contained in:
Girish Ramakrishnan
2025-06-19 10:12:59 +02:00
parent b23699f0c1
commit 84111996b4

View File

@@ -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);