From adacdd3a9fbabeb39cf78fec4e8cc608907b197e Mon Sep 17 00:00:00 2001 From: Robert Hillis Date: Mon, 17 Jun 2024 13:18:59 -0400 Subject: [PATCH] Run Radarr movie coordinator first refresh in background (#119827) --- homeassistant/components/radarr/__init__.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/homeassistant/components/radarr/__init__.py b/homeassistant/components/radarr/__init__.py index b528e701c71..1023bf10659 100644 --- a/homeassistant/components/radarr/__init__.py +++ b/homeassistant/components/radarr/__init__.py @@ -70,7 +70,16 @@ async def async_setup_entry(hass: HomeAssistant, entry: RadarrConfigEntry) -> bo status=StatusDataUpdateCoordinator(hass, host_configuration, radarr), ) for field in fields(data): - await getattr(data, field.name).async_config_entry_first_refresh() + coordinator: RadarrDataUpdateCoordinator = getattr(data, field.name) + # Movie update can take a while depending on Radarr database size + if field.name == "movie": + entry.async_create_background_task( + hass, + coordinator.async_config_entry_first_refresh(), + "radarr.movie-coordinator-first-refresh", + ) + continue + await coordinator.async_config_entry_first_refresh() entry.runtime_data = data await hass.config_entries.async_forward_entry_setups(entry, PLATFORMS)