Channel.start with integer start_delay led to a traceback. Resolve #3240

This commit is contained in:
Griatch 2023-08-06 21:47:59 +02:00
parent 9f08b6c9df
commit abc55276c6
2 changed files with 8 additions and 3 deletions

View file

@ -7,6 +7,7 @@
- Fix: Make sure `at_server_reload` is called also on non-repeating Scripts.
- Fix: Webclient was not giving a proper error when sending an unknown outputfunc to it.
- Fix: Make `py` command always send strings unless `client_raw` flag is set.
- Fix: `Script.start` with an integer `start_delay` caused a traceback.
- Docs: Remove doc pages for Travis/TeamCity CI tools, they were both very much
out of date, and Travis is not free for OSS anymore.
- Docs: A lot fixes of typos and bugs in tutorials.

View file

@ -205,7 +205,9 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase):
self.db_interval = interval
update_fields.append("db_interval")
if start_delay is not None:
self.db_start_delay = start_delay
# note that for historical reasons, the start_delay is a boolean field, not an int; the
# actual value is only used with the task.
self.db_start_delay = bool(start_delay)
update_fields.append("db_start_delay")
if repeats is not None:
self.db_repeats = repeats
@ -244,7 +246,9 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase):
if not self.ndb._task.running:
# if not unpausing started it, start script anew with the new values
self.ndb._task.start(self.db_interval, now=not self.db_start_delay)
self.ndb._task.start(
self.db_interval, now=not self.db_start_delay, start_delay=start_delay
)
self.at_start(**kwargs)
@ -547,7 +551,7 @@ class ScriptBase(ScriptDB, metaclass=TypeclassBase):
Keyword Args:
interval (int): How often to fire `at_repeat` in seconds.
start_delay (int): If the start of ticking should be delayed.
start_delay (int): If the start of ticking should be delayed and by how much.
repeats (int): How many repeats. 0 for infinite repeats.
**kwargs: Optional (default unused) kwargs passed on into the `at_start` hook.