fix(TimerMgr): cancel existing timer before creating a new one
This commit is contained in:
@@ -11,8 +11,7 @@ class TimerMgr {
|
|||||||
|
|
||||||
create(id, timeout, func, ...params) {
|
create(id, timeout, func, ...params) {
|
||||||
if (this.hasTimer(id)) {
|
if (this.hasTimer(id)) {
|
||||||
log.error(`Timer with id ${id} already exists`);
|
this.cancel(id);
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
log.debug("Create timer with id " + id);
|
log.debug("Create timer with id " + id);
|
||||||
this.#timers[id] = actions.ScriptExecution.createTimer(id, timeout, func, ...params);
|
this.#timers[id] = actions.ScriptExecution.createTimer(id, timeout, func, ...params);
|
||||||
|
|||||||
Reference in New Issue
Block a user