Run Radarr movie coordinator first refresh in background (#119827)

pull/118047/head
Robert Hillis 2024-06-17 13:18:59 -04:00 committed by GitHub
parent e5eef7c6dd
commit adacdd3a9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 1 deletions

View File

@ -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)