From 7effbdb27a6df7475edbf2e6bb8bb4d67a0c715e Mon Sep 17 00:00:00 2001 From: Mike Vostrikov <11011125+mikevostrikov@users.noreply.github.com> Date: Sat, 19 Aug 2023 01:48:23 -0400 Subject: [PATCH] Force process crash on mqtt error To circumvent this error https://community.flic.io/topic/18257/cannot-push-beyond-allocated-stack-fatal-error --- main.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/main.js b/main.js index 33c6823..ee8faad 100644 --- a/main.js +++ b/main.js @@ -218,12 +218,10 @@ mqtt.on('disconnected', function() { mqtt.connect(); }); -mqtt.on('error', function() { - setTimeout(function (){ - mqtt.connect(); - }, 1000); +mqtt.on('error', function () { + setTimeout(function () { + throw new Error("Crashed") + }, 1000); }); - - mqtt.connect();