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

mysql - slightly overzealous closing of connections - causes crash. backed off slightly

This commit is contained in:
Dave Conway-Jones 2020-04-05 12:35:15 +01:00
parent 705dd1ffc1
commit fa8e174d0b
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
2 changed files with 3 additions and 2 deletions

View File

@ -19,8 +19,8 @@ module.exports = function(RED) {
function checkVer() { function checkVer() {
node.connection.query("SELECT version();", [], function(err, rows) { node.connection.query("SELECT version();", [], function(err, rows) {
node.connection.release();
if (err) { if (err) {
node.connection.release();
node.error(err); node.error(err);
node.status({fill:"red",shape:"ring",text:"Bad Ping"}); node.status({fill:"red",shape:"ring",text:"Bad Ping"});
doConnect(); doConnect();
@ -103,6 +103,7 @@ module.exports = function(RED) {
RED.nodes.createNode(this,n); RED.nodes.createNode(this,n);
this.mydb = n.mydb; this.mydb = n.mydb;
this.mydbConfig = RED.nodes.getNode(this.mydb); this.mydbConfig = RED.nodes.getNode(this.mydb);
this.status({});
if (this.mydbConfig) { if (this.mydbConfig) {
this.mydbConfig.connect(); this.mydbConfig.connect();

View File

@ -1,6 +1,6 @@
{ {
"name": "node-red-node-mysql", "name": "node-red-node-mysql",
"version": "0.0.21", "version": "0.0.22",
"description": "A Node-RED node to read and write to a MySQL database", "description": "A Node-RED node to read and write to a MySQL database",
"dependencies": { "dependencies": {
"mysql": "^2.18.1" "mysql": "^2.18.1"