Fix provider load at startup (#1455)
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Sat, 6 Jul 2024 09:23:03 +0000 (11:23 +0200)
committerGitHub <noreply@github.com>
Sat, 6 Jul 2024 09:23:03 +0000 (11:23 +0200)
music_assistant/server/providers/hass/__init__.py
music_assistant/server/server.py

index 8f9de96cf9a9609ea5d4d4bd4ed6c6e976a95898..3f7c1100245f3b26512df32b82af51e52903ab20 100644 (file)
@@ -117,6 +117,14 @@ async def get_config_entries(
                 value=None,
                 hidden=True,
             ),
+            ConfigEntry(
+                key=CONF_VERIFY_SSL,
+                type=ConfigEntryType.BOOLEAN,
+                label=CONF_VERIFY_SSL,
+                required=False,
+                default_value=False,
+                hidden=True,
+            ),
         )
     # manual configuration
     return (
index 2816573637718cbf67531d8bca7fae46757b931e..c09a2a30b65b24e8e73097ba5acbf368f01d3a49 100644 (file)
@@ -477,8 +477,9 @@ class MusicAssistant:
                     allow_retry,
                     task_id=task_id,
                 )
-            else:
-                raise
+                return
+            # raise in all other situations
+            raise
 
     async def unload_provider(self, instance_id: str) -> None:
         """Unload a provider."""
@@ -537,11 +538,12 @@ class MusicAssistant:
 
         # load all configured (and enabled) providers
         prov_configs = await self.config.get_provider_configs(include_values=True)
-        async with asyncio.TaskGroup() as tg:
-            for prov_conf in prov_configs:
-                if not prov_conf.enabled:
-                    continue
-                tg.create_task(self.load_provider(prov_conf.instance_id, allow_retry=True))
+        for prov_conf in prov_configs:
+            if not prov_conf.enabled:
+                continue
+            # Use a task so we can load multiple providers at once.
+            # If a provider fails, that will not block the loading of other providers.
+            self.create_task(self.load_provider(prov_conf.instance_id, allow_retry=True))
 
     async def _load_provider(self, conf: ProviderConfig) -> None:
         """Load (or reload) a provider."""