tidy up mysql some more

remove listeners on close and update status on partial deploy
This commit is contained in:
Dave Conway-Jones 2016-11-27 19:21:57 +00:00
parent 738eada16b
commit fe1a96d67d
2 changed files with 9 additions and 4 deletions

View File

@ -56,9 +56,9 @@ module.exports = function(RED) {
}
this.connect = function() {
if (!this.connected && !this.connecting) {
doConnect();
}
if (!this.connected && !this.connecting) { doConnect(); }
if (this.connected) { node.emit("state","connected"); }
else { node.emit("state","connecting"); }
}
this.on('close', function (done) {
@ -127,6 +127,11 @@ module.exports = function(RED) {
node.status({fill:"red",shape:"ring",text:"not yet connected"});
}
});
node.on('close', function () {
node.mydbConfig.removeAllListeners();
node.status({});
});
}
else {
this.error("MySQL database not configured");

View File

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