Use an eager task for Sonos async_update_device_properties (#112488)

If the device does not need to be polled for the battery state which
is only present on portable speakers, the task will never suspend
and never need to be scheduled on the event loop
This commit is contained in:
J. Nick Koston 2024-03-06 08:10:26 -10:00 committed by GitHub
parent 770e48d512
commit 7096701cab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -456,7 +456,9 @@ class SonosSpeaker:
def async_dispatch_device_properties(self, event: SonosEvent) -> None:
"""Update device properties from an event."""
self.event_stats.process(event)
self.hass.async_create_task(self.async_update_device_properties(event))
self.hass.async_create_task(
self.async_update_device_properties(event), eager_start=True
)
async def async_update_device_properties(self, event: SonosEvent) -> None:
"""Update device properties from an event."""