mirror of
https://github.com/home-assistant/core.git
synced 2025-07-22 20:57:21 +00:00
Use eager start for august subscriber refreshes (#111581)
Since most of the time this call will be a noop since pubnub will be connected we can avoid scheduling a task on the event loop every time it fires
This commit is contained in:
parent
cfe478245f
commit
1e02260bbe
@ -43,12 +43,17 @@ class AugustSubscriberMixin:
|
||||
async def _async_refresh(self, time: datetime) -> None:
|
||||
"""Refresh data."""
|
||||
|
||||
@callback
|
||||
def _async_scheduled_refresh(self, now: datetime) -> None:
|
||||
"""Call the refresh method."""
|
||||
self._hass.async_create_task(self._async_refresh(now), eager_start=True)
|
||||
|
||||
@callback
|
||||
def _async_setup_listeners(self) -> None:
|
||||
"""Create interval and stop listeners."""
|
||||
self._unsub_interval = async_track_time_interval(
|
||||
self._hass,
|
||||
self._async_refresh,
|
||||
self._async_scheduled_refresh,
|
||||
self._update_interval,
|
||||
name="august refresh",
|
||||
)
|
||||
|
Loading…
x
Reference in New Issue
Block a user