Fix race in script wait for trigger step (#46055)
* Fix race in script wait for trigger step * Update script.py * Update script.py
This commit is contained in:
parent
f2d9e6f70c
commit
8a7e0241ab
1 changed files with 2 additions and 1 deletions
|
@ -623,6 +623,8 @@ class _ScriptRun:
|
|||
variables = {**self._variables}
|
||||
self._variables["wait"] = {"remaining": delay, "trigger": None}
|
||||
|
||||
done = asyncio.Event()
|
||||
|
||||
async def async_done(variables, context=None):
|
||||
self._variables["wait"] = {
|
||||
"remaining": to_context.remaining if to_context else delay,
|
||||
|
@ -647,7 +649,6 @@ class _ScriptRun:
|
|||
return
|
||||
|
||||
self._changed()
|
||||
done = asyncio.Event()
|
||||
tasks = [
|
||||
self._hass.async_create_task(flag.wait()) for flag in (self._stop, done)
|
||||
]
|
||||
|
|
Loading…
Add table
Reference in a new issue