Commit 019f014d authored by David Trattnig's avatar David Trattnig
Browse files

TImer ID as thread names. #62

parent 5cfc9960
......@@ -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
thread = Thread(target = self.func, args = (self.param,))
thread = Thread(name=self.timer_id, target=self.func, args=(self.param,))
def exec_timed(self):
Timed execution in a thread.
Assigns the `timer_id` as the thread name.
def wrapper_func(param=None):
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.")
return False
# Still waiting for execution -> update
......@@ -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)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment