Make eager_start default to True for async_create_background_task (#114996)

This commit is contained in:
J. Nick Koston 2024-04-06 09:53:50 -10:00 committed by GitHub
parent 8f425b9ea7
commit 166910f587
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 6 additions and 3 deletions

View file

@ -448,7 +448,7 @@ class ImapPushDataUpdateCoordinator(ImapDataUpdateCoordinator):
async def async_start(self) -> None: async def async_start(self) -> None:
"""Start coordinator.""" """Start coordinator."""
self._push_wait_task = self.hass.async_create_background_task( self._push_wait_task = self.hass.async_create_background_task(
self._async_wait_push_loop(), "Wait for IMAP data push" self._async_wait_push_loop(), "Wait for IMAP data push", eager_start=False
) )
async def _async_wait_push_loop(self) -> None: async def _async_wait_push_loop(self) -> None:

View file

@ -149,7 +149,9 @@ class OllamaConfigFlow(ConfigFlow, domain=DOMAIN):
# The task will block until the model and metadata are fully # The task will block until the model and metadata are fully
# downloaded. # downloaded.
self.download_task = self.hass.async_create_background_task( self.download_task = self.hass.async_create_background_task(
self.client.pull(self.model), f"Downloading {self.model}" self.client.pull(self.model),
f"Downloading {self.model}",
eager_start=False,
) )
if self.download_task.done(): if self.download_task.done():

View file

@ -432,6 +432,7 @@ class ZeroconfDiscovery:
zeroconf, async_service_info, service_type, name zeroconf, async_service_info, service_type, name
), ),
name=f"zeroconf lookup {name}.{service_type}", name=f"zeroconf lookup {name}.{service_type}",
eager_start=False,
) )
async def _async_lookup_and_process_service_update( async def _async_lookup_and_process_service_update(

View file

@ -742,7 +742,7 @@ class HomeAssistant:
@callback @callback
def async_create_background_task( def async_create_background_task(
self, target: Coroutine[Any, Any, _R], name: str, eager_start: bool = False self, target: Coroutine[Any, Any, _R], name: str, eager_start: bool = True
) -> asyncio.Task[_R]: ) -> asyncio.Task[_R]:
"""Create a task from within the event loop. """Create a task from within the event loop.