diff --git a/server/util-server.js b/server/util-server.js index 074867f7..7a14a23d 100644 --- a/server/util-server.js +++ b/server/util-server.js @@ -105,7 +105,7 @@ exports.mqttAsync = function (hostname, topic, okMessage, options = {}) { log.debug("mqtt", "MQTT timeout triggered"); client.end(); reject("Timeout"); - }, interval * 1000); + }, interval * 1000 * 0.8); log.debug("mqtt", "MQTT connecting"); @@ -121,6 +121,8 @@ exports.mqttAsync = function (hostname, topic, okMessage, options = {}) { try { client.subscribe(topic); } catch (e) { + client.end(); + clearTimeout(timeoutID); reject(new Error("Cannot subscribe topic")); } }); diff --git a/src/pages/EditMonitor.vue b/src/pages/EditMonitor.vue index 6dc48e07..c118f53c 100644 --- a/src/pages/EditMonitor.vue +++ b/src/pages/EditMonitor.vue @@ -172,7 +172,7 @@