Add try catch to connection.release so it can't crash the server

This commit is contained in:
Holly Stubbs 2022-07-05 08:13:20 +01:00
parent 68c0f1a880
commit 82bef6018b
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -19,7 +19,10 @@ module.exports = class {
this.connectionPool.getConnection((err, connection) => { this.connectionPool.getConnection((err, connection) => {
if (err) { if (err) {
reject(err); reject(err);
connection.release(); try { connection.release();}
catch (e) {
console.error("Failed to release mysql connection", err);
}
} else { } else {
// Use old query // Use old query
if (data == null) { if (data == null) {