diff --git a/homeassistant/core.py b/homeassistant/core.py index 5f340bdd941..18cb6e2e2c1 100644 --- a/homeassistant/core.py +++ b/homeassistant/core.py @@ -252,8 +252,9 @@ class HomeAssistant(object): """Block till all pending work is done.""" while True: # Wait for the pending tasks are down - if len(self._pending_tasks) > 0: - yield from asyncio.wait(self._pending_tasks, loop=self.loop) + pending = list(self._pending_tasks) + if len(pending) > 0: + yield from asyncio.wait(pending, loop=self.loop) # Verify the loop is empty ret = yield from self.loop.run_in_executor(None, self._loop_empty)