mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Fixup mysql node done calls
This commit is contained in:
parent
915089f2fb
commit
2c5cc5f70c
@ -124,6 +124,7 @@ module.exports = function(RED) {
|
||||
});
|
||||
|
||||
node.on("input", function(msg, send, done) {
|
||||
send = send || function() { node.send.apply(node,arguments) };
|
||||
if (node.mydbConfig.connected) {
|
||||
if (typeof msg.topic === 'string') {
|
||||
//console.log("query:",msg.topic);
|
||||
@ -157,23 +158,24 @@ module.exports = function(RED) {
|
||||
msg.payload = rows.map(v => Object.assign({}, v));
|
||||
}
|
||||
else { msg.payload = rows; }
|
||||
node.send(msg);
|
||||
send(msg);
|
||||
status = {fill:"green",shape:"dot",text:"OK"};
|
||||
node.status(status);
|
||||
done();
|
||||
}
|
||||
done();
|
||||
// if (node.mydbConfig.pool._freeConnections.indexOf(node.mydbConfig.connection) === -1) {
|
||||
// node.mydbConfig.connection.release();
|
||||
// }
|
||||
});
|
||||
}
|
||||
else {
|
||||
if (typeof msg.topic !== 'string') { node.error("msg.topic : the query is not defined as a string"); }
|
||||
if (typeof msg.topic !== 'string') { node.error("msg.topic : the query is not defined as a string"); done(); }
|
||||
}
|
||||
}
|
||||
else {
|
||||
node.error("Database not connected",msg);
|
||||
status = {fill:"red",shape:"ring",text:"not yet connected"};
|
||||
done();
|
||||
}
|
||||
if (!busy) {
|
||||
busy = true;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "node-red-node-mysql",
|
||||
"version": "0.1.6",
|
||||
"version": "0.1.7",
|
||||
"description": "A Node-RED node to read and write to a MySQL database",
|
||||
"dependencies": {
|
||||
"mysql": "^2.18.1"
|
||||
|
Loading…
Reference in New Issue
Block a user