1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Mysql fix (#886)

* Check if there is a connection before release

Fixes #885
This commit is contained in:
Ben Hardill 2022-02-21 20:08:33 +00:00 committed by GitHub
parent 5c333db0dd
commit 87e50f2b76
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -114,7 +114,9 @@ module.exports = function(RED) {
//console.log("query:",msg.topic); //console.log("query:",msg.topic);
node.mydbConfig.pool.getConnection(function (err, conn) { node.mydbConfig.pool.getConnection(function (err, conn) {
if (err) { if (err) {
if (conn) {
conn.release() conn.release()
}
status = { fill: "red", shape: "ring", text: RED._("mysql.status.error") + ": " + err.code }; status = { fill: "red", shape: "ring", text: RED._("mysql.status.error") + ": " + err.code };
node.status(status); node.status(status);
node.error(err, msg); node.error(err, msg);