Skip to content

Commit

Permalink
Fix race in script wait for trigger step (#46055)
Browse files Browse the repository at this point in the history
* Fix race in script wait for trigger step

* Update script.py

* Update script.py
  • Loading branch information
emontnemery committed Feb 6, 2021
1 parent f2d9e6f commit 8a7e024
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion homeassistant/helpers/script.py
Expand Up @@ -623,6 +623,8 @@ async def _async_wait_for_trigger_step(self):
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,
Expand All @@ -647,7 +649,6 @@ def log_cb(level, msg, **kwargs):
return

self._changed()
done = asyncio.Event()
tasks = [
self._hass.async_create_task(flag.wait()) for flag in (self._stop, done)
]
Expand Down

0 comments on commit 8a7e024

Please sign in to comment.