From fa635f46d9f6f58dd98116f89db67fa85908899d Mon Sep 17 00:00:00 2001 From: Christian Weimann Date: Mon, 13 Jan 2025 08:59:18 +0100 Subject: [PATCH] fix(TimerMgr): cancel existing timer before creating a new one --- utils/TimerMgr.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/utils/TimerMgr.js b/utils/TimerMgr.js index 886c4af..6d9ecbc 100644 --- a/utils/TimerMgr.js +++ b/utils/TimerMgr.js @@ -11,8 +11,7 @@ class TimerMgr { create(id, timeout, func, ...params) { if (this.hasTimer(id)) { - log.error(`Timer with id ${id} already exists`); - return; + this.cancel(id); } log.debug("Create timer with id " + id); this.#timers[id] = actions.ScriptExecution.createTimer(id, timeout, func, ...params);