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

Merge pull request #3992 from node-red/fix-mqtt-reconnect

Fix mqtt nodes not reconnecting on modified-flows deploy
This commit is contained in:
Nick O'Leary 2023-01-01 14:09:33 +00:00 committed by GitHub
commit e0d71abdc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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();
}
done();
};
node.canConnect = function() {
return !node.connected && !node.connecting;