mirror of
https://github.com/home-assistant/core.git
synced 2025-07-13 08:17:08 +00:00
Use an eager task to update multiple entities (#111556)
If there are multiple entities on the same platform its likely that only one of them will suspend in the update so schedule them eagerly
This commit is contained in:
parent
f6622ea8e0
commit
b75277cc24
@ -32,6 +32,7 @@ from homeassistant.core import (
|
|||||||
from homeassistant.exceptions import HomeAssistantError, PlatformNotReady
|
from homeassistant.exceptions import HomeAssistantError, PlatformNotReady
|
||||||
from homeassistant.generated import languages
|
from homeassistant.generated import languages
|
||||||
from homeassistant.setup import async_start_setup
|
from homeassistant.setup import async_start_setup
|
||||||
|
from homeassistant.util.async_ import create_eager_task
|
||||||
|
|
||||||
from . import (
|
from . import (
|
||||||
config_validation as cv,
|
config_validation as cv,
|
||||||
@ -988,7 +989,7 @@ class EntityPlatform:
|
|||||||
return
|
return
|
||||||
|
|
||||||
if tasks := [
|
if tasks := [
|
||||||
entity.async_update_ha_state(True)
|
create_eager_task(entity.async_update_ha_state(True))
|
||||||
for entity in self.entities.values()
|
for entity in self.entities.values()
|
||||||
if entity.should_poll
|
if entity.should_poll
|
||||||
]:
|
]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user