Avoid creating tasks to shutdown entity platforms (#111026)
* Avoid creating tasks to shutdown entity platforms Nothing needed to be awaited here * fix mocking * missed one test
This commit is contained in:
parent
98d5f2fc01
commit
dc4008c518
4 changed files with 10 additions and 9 deletions
|
@ -5,7 +5,6 @@ import asyncio
|
|||
from collections.abc import Callable, Iterable
|
||||
from datetime import timedelta
|
||||
from functools import partial
|
||||
from itertools import chain
|
||||
import logging
|
||||
from types import ModuleType
|
||||
from typing import Any, Generic
|
||||
|
@ -394,8 +393,8 @@ class EntityComponent(Generic[_EntityT]):
|
|||
entity_platform.async_prepare()
|
||||
return entity_platform
|
||||
|
||||
async def _async_shutdown(self, event: Event) -> None:
|
||||
@callback
|
||||
def _async_shutdown(self, event: Event) -> None:
|
||||
"""Call when Home Assistant is stopping."""
|
||||
await asyncio.gather(
|
||||
*(platform.async_shutdown() for platform in chain(self._platforms.values()))
|
||||
)
|
||||
for platform in self._platforms.values():
|
||||
platform.async_shutdown()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue