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 firespull/111574/head^2
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…
Reference in New Issue