Fix mqtt nodes not reconnected on modified-flows deploy

pull/3992/head
Nick O'Leary 2022-12-27 14:56:32 +00:00
parent b3ce0c0079
commit ce57ba80eb
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 10 additions and 9 deletions

View File

@ -718,9 +718,10 @@ module.exports = function(RED) {
node.deregister = function(mqttNode, done, autoDisconnect) {
delete node.users[mqttNode.id];
if (autoDisconnect && !node.closing && node.connected && Object.keys(node.users).length === 0) {
node.disconnect();
}
node.disconnect(done);
} else {
done();
}
};
node.canConnect = function() {
return !node.connected && !node.connecting;