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}
|
variables = {**self._variables}
|
||||||
self._variables["wait"] = {"remaining": delay, "trigger": None}
|
self._variables["wait"] = {"remaining": delay, "trigger": None}
|
||||||
|
|
||||||
|
done = asyncio.Event()
|
||||||
|
|
||||||
async def async_done(variables, context=None):
|
async def async_done(variables, context=None):
|
||||||
self._variables["wait"] = {
|
self._variables["wait"] = {
|
||||||
"remaining": to_context.remaining if to_context else delay,
|
"remaining": to_context.remaining if to_context else delay,
|
||||||
|
@ -647,7 +649,6 @@ class _ScriptRun:
|
||||||
return
|
return
|
||||||
|
|
||||||
self._changed()
|
self._changed()
|
||||||
done = asyncio.Event()
|
|
||||||
tasks = [
|
tasks = [
|
||||||
self._hass.async_create_task(flag.wait()) for flag in (self._stop, done)
|
self._hass.async_create_task(flag.wait()) for flag in (self._stop, done)
|
||||||
]
|
]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue