From 9856f6e4ac20205804fbc1db2d998dec764bd8a3 Mon Sep 17 00:00:00 2001 From: Ian Campbell Date: Sun, 15 Dec 2024 13:42:26 +0000 Subject: [PATCH] Fix: Correct maxsize of `MetadataLookupQueue` Setting a default in the `_init_` hook is ineffective because the `asyncio.Queue.__init__` always passes in a concrete value. Since that constructor itself sets a default of zero this is what is used unless we pass in a size at construction time. Fixes https://github.com/music-assistant/hass-music-assistant/issues/3230. --- music_assistant/controllers/metadata.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/music_assistant/controllers/metadata.py b/music_assistant/controllers/metadata.py index 29b433c67..19b4259c9 100644 --- a/music_assistant/controllers/metadata.py +++ b/music_assistant/controllers/metadata.py @@ -123,7 +123,7 @@ def __init__(self, *args, **kwargs) -> None: "Music Assistant's core controller which handles all metadata for music." ) self.manifest.icon = "book-information-variant" - self._lookup_jobs: MetadataLookupQueue = MetadataLookupQueue() + self._lookup_jobs: MetadataLookupQueue = MetadataLookupQueue(100) self._lookup_task: asyncio.Task | None = None self._throttler = Throttler(1, 30) self._missing_metadata_scan_task: asyncio.Task | None = None @@ -796,7 +796,7 @@ async def _scan_missing_metadata(self) -> None: class MetadataLookupQueue(asyncio.Queue): """Representation of a queue for metadata lookups.""" - def _init(self, maxlen: int = 100): + def _init(self, maxlen: int): self._queue: collections.deque[str] = collections.deque(maxlen=maxlen) def _put(self, item: str) -> None: