mirror of
https://github.com/home-assistant/core.git
synced 2025-07-28 23:57:06 +00:00
Update Coordinator: Only schedule a refresh if listenerrs (#34317)
This commit is contained in:
parent
059df5e3e2
commit
317d08b6c1
@ -163,7 +163,8 @@ class DataUpdateCoordinator:
|
|||||||
self.name,
|
self.name,
|
||||||
monotonic() - start,
|
monotonic() - start,
|
||||||
)
|
)
|
||||||
self._schedule_refresh()
|
if self._listeners:
|
||||||
|
self._schedule_refresh()
|
||||||
|
|
||||||
for update_callback in self._listeners:
|
for update_callback in self._listeners:
|
||||||
update_callback()
|
update_callback()
|
||||||
|
@ -40,6 +40,8 @@ async def test_async_refresh(crd):
|
|||||||
await crd.async_refresh()
|
await crd.async_refresh()
|
||||||
assert crd.data == 1
|
assert crd.data == 1
|
||||||
assert crd.last_update_success is True
|
assert crd.last_update_success is True
|
||||||
|
# Make sure we didn't schedule a refresh because we have 0 listeners
|
||||||
|
assert crd._unsub_refresh is None
|
||||||
|
|
||||||
updates = []
|
updates = []
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user