added timeout for removing the dead loop state

This commit is contained in:
Tarun Singh 2022-01-20 13:04:59 -05:00
parent 227bbdea2f
commit 22256dfcd2
2 changed files with 5 additions and 2 deletions

View file

@ -359,8 +359,10 @@ class Monitor extends BeanModel {
});
bean.status = UP;
} catch (error) {
bean.status = DOWN;
bean.msg = error.message;
if (error.message !== "Timeout") {
bean.status = DOWN;
bean.msg = error.message;
}
}
} else {
bean.msg = "Unknown Monitor Type";

View file

@ -131,6 +131,7 @@ exports.mqttAsync = function (hostname, topic, okMessage, options = {}) {
setTimeout(() => {
client.end();
reject("Timeout");
}, interval * 1000);
});