This commit is contained in:
Ciro Spaciari
2025-09-08 20:50:40 -07:00
parent 6f125e0375
commit b809cd297e

View File

@@ -396,19 +396,13 @@ class PooledMySQLConnection {
this.queryCount = 0;
this.flags &= ~PooledConnectionFlags.reserved;
try {
// notify all queries that the connection is closed
for (const onClose of queries) {
onClose(err);
}
const onFinish = this.onFinish;
if (onFinish) {
onFinish(err);
}
} catch (e) {
console.log("onClose error", e, this instanceof PooledMySQLConnection, this, this.queries);
console.log("error", err);
throw e;
// notify all queries that the connection is closed
for (const onClose of queries) {
onClose(err);
}
const onFinish = this.onFinish;
if (onFinish) {
onFinish(err);
}
this.adapter.release(this, true);
@@ -425,7 +419,7 @@ class PooledMySQLConnection {
this.connection = await PooledMySQLConnection.createConnection(
this.connectionInfo,
this.#onConnected.bind(this),
this.#onClose.bind(this),
(...args) => this.#onClose(...args),
);
}