mirror of
https://github.com/home-assistant/core.git
synced 2025-11-08 10:29:27 +00:00
Run coroutines as eager tasks in async_run_hass_job (#111683)
* Run coroutines as eager tasks in async_run_hass_job
Note that this does not change async_add_hass_job
Do not merge this. For test run only
* Phase out periodic tasks
* false by default or some tests will block forever, will need to fix each one manually
* kwarg works
* kwarg works
* kwarg works
* fixes
* fix more tests
* fix more tests
* fix lifx
* opensky
* pvpc_hourly_pricing
* adjust more
* adjust more
* smarttub
* adjust more
* adjust more
* adjust more
* adjust more
* adjust
* no eager executor
* zha
* qnap_qsw
* fix more
* fix fix
* docs
* its a wrapper now
* add more coverage
* coverage
* cover all combos
* more fixes
* more fixes
* more fixes
* remaining issues are legit bugs in tests
* make tplink test more predictable
* more fixes
* feedreader
* grind out some more
* make test race safe
* limit first scope to triggers
* one more
* Start tasks eagerly in for async_at_start(ed)
A few of these can avoid being scheduled on the loop
during startup
* fix cloud
* Revert "fix cloud"
This reverts commit 5eb3ce695d.
* fix test to do what start does
* flip flag
* flip flag
* Fix here_travel_time creating many refresh requests at startup
- Each entity would try to refresh the coordinator which
created many tasks. Move the refresh to a single
async_at_started
- The tests fired the EVENT_HOMEASSISTANT_START event
but the code used async_at_started which only worked
because the tests did not set CoreState to not_running
* fix azure
* remove kw
* remove kw
* rip
* cover
* more rips
* more rips
* more rips
This commit is contained in:
@@ -328,7 +328,7 @@ def _async_dispatch_entity_id_event(
|
||||
return
|
||||
for job in callbacks_list.copy():
|
||||
try:
|
||||
hass.async_run_hass_job(job, event, eager_start=True)
|
||||
hass.async_run_hass_job(job, event)
|
||||
except Exception: # pylint: disable=broad-except
|
||||
_LOGGER.exception(
|
||||
"Error while dispatching event for %s to %s",
|
||||
@@ -1599,7 +1599,7 @@ class _TrackTimeInterval:
|
||||
self._track_job,
|
||||
hass.loop.time() + self.seconds,
|
||||
)
|
||||
hass.async_run_hass_job(self._run_job, now, eager_start=True, background=True)
|
||||
hass.async_run_hass_job(self._run_job, now, background=True)
|
||||
|
||||
@callback
|
||||
def async_cancel(self) -> None:
|
||||
@@ -1684,7 +1684,7 @@ class SunListener:
|
||||
"""Handle solar event."""
|
||||
self._unsub_sun = None
|
||||
self._listen_next_sun_event()
|
||||
self.hass.async_run_hass_job(self.job, eager_start=True, background=True)
|
||||
self.hass.async_run_hass_job(self.job, background=True)
|
||||
|
||||
@callback
|
||||
def _handle_config_event(self, _event: Any) -> None:
|
||||
@@ -1770,9 +1770,7 @@ class _TrackUTCTimeChange:
|
||||
# time when the timer was scheduled
|
||||
utc_now = time_tracker_utcnow()
|
||||
localized_now = dt_util.as_local(utc_now) if self.local else utc_now
|
||||
hass.async_run_hass_job(
|
||||
self.job, localized_now, eager_start=True, background=True
|
||||
)
|
||||
hass.async_run_hass_job(self.job, localized_now, background=True)
|
||||
if TYPE_CHECKING:
|
||||
assert self._pattern_time_change_listener_job is not None
|
||||
self._cancel_callback = async_track_point_in_utc_time(
|
||||
|
||||
Reference in New Issue
Block a user