diff --git a/src/core/control.py b/src/core/control.py index e099aa1860c2b44cb178d75e6e8ace8f19640305..9adac8ccb13bcb0637b205d332a35aa738a2bdaa 100644 --- a/src/core/control.py +++ b/src/core/control.py @@ -264,23 +264,27 @@ class EngineExecutor(Timer): def exec_now(self): """ Immediate execution within a thread. It's not stored in the timer store. + + Assigns the `timer_id` as the thread name. """ self.direct_exec = True self.wait_for_parent() - thread = Thread(target = self.func, args = (self.param,)) + thread = Thread(name=self.timer_id, target=self.func, args=(self.param,)) thread.start() - self.cancel() def exec_timed(self): """ Timed execution in a thread. + + Assigns the `timer_id` as the thread name. """ def wrapper_func(param=None): self.wait_for_parent() if param: self.func(param,) else: self.func() super().__init__(self.diff, wrapper_func, (self.param,)) + self._name = self.timer_id def update_store(self): @@ -303,7 +307,6 @@ class EngineExecutor(Timer): # Check if existing timer has been executed already -> don't update if not existing_command.is_alive(): self.logger.debug(f"Existing dead timer with ID: {self.timer_id}. Don't update.") - self.cancel() return False # Still waiting for execution -> update diff --git a/src/scheduling/scheduler.py b/src/scheduling/scheduler.py index 931e9184d2013a680c61e2e98effdd5c4a991070..5fb0d4454c4b69a92eae2a26299a8ea517f1267c 100644 --- a/src/scheduling/scheduler.py +++ b/src/scheduling/scheduler.py @@ -471,7 +471,7 @@ class PlayCommand(EngineExecutor): start_preload = entries[0].start_unix - self.config.get("preload_offset") start_play = entries[0].start_unix - super().__init__("PRELOAD", None, start_preload, self.do_preload, entries) + super().__init__("PLAY", None, start_preload, self.do_preload, entries) EngineExecutor("PLAY", self, start_play, self.do_play, entries)