From e3fe04a910eb7c6efab12cedfb71efa7eb87716c Mon Sep 17 00:00:00 2001 From: Frederik <53608074+N0chteil@users.noreply.github.com> Date: Sun, 22 Oct 2023 13:43:25 +0200 Subject: [PATCH] [AMR-99] fix: this.connect is not a function --- src/managers/watchdog.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/managers/watchdog.ts b/src/managers/watchdog.ts index 3e16a3e..31a303d 100644 --- a/src/managers/watchdog.ts +++ b/src/managers/watchdog.ts @@ -36,6 +36,8 @@ export class WatchDog { } async init() { + const that = this; + if (this.watchdogUpdating) { log.info("[WatchDog]", "WatchDog is updating"); @@ -44,20 +46,20 @@ export class WatchDog { if (WatchDogDetails("status")) { log.info("[WatchDog]", "WatchDog is installed"); - if (await WatchDogDetails("running")) this.connect(); + if (await WatchDogDetails("running")) that.connect(); else { WatchDogState(true); setTimeout(async () => { - if (await WatchDogDetails("running")) this.connect(); - else this.init(); + if (await WatchDogDetails("running")) that.connect(); + else that.init(); }, 2500); } } else { log.info("[WatchDog]", "WatchDog is not installed"); if (config.get("watchdog.autoUpdates")) { - setTimeout(() => this.init(), 3000); + setTimeout(that.init, 3000); return; }