From e2e7e963a1eb4483406f70f3f4f115e7a50fdb84 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Thu, 4 Dec 2025 09:55:42 +0100 Subject: [PATCH] Filter slow callback logging for buffered_generator --- music_assistant/__main__.py | 8 +++++--- music_assistant/helpers/buffered_generator.py | 8 +++++++- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/music_assistant/__main__.py b/music_assistant/__main__.py index 956ed2c2..41cb778a 100644 --- a/music_assistant/__main__.py +++ b/music_assistant/__main__.py @@ -140,9 +140,11 @@ def setup_logger(data_path: str, level: str = "DEBUG") -> logging.Logger: def filter(self, record: logging.LogRecord) -> bool: """Return False to suppress the log record.""" - return not ( - record.levelno == logging.WARNING and "buffered..producer()" in record.msg - ) + if record.levelno != logging.WARNING: + return True + # Check the formatted message, not the format string + msg = record.getMessage() + return "buffered..producer()" not in msg logging.getLogger("asyncio").addFilter(BufferedGeneratorFilter()) diff --git a/music_assistant/helpers/buffered_generator.py b/music_assistant/helpers/buffered_generator.py index 9a16823b..e8e2fda4 100644 --- a/music_assistant/helpers/buffered_generator.py +++ b/music_assistant/helpers/buffered_generator.py @@ -54,7 +54,13 @@ async def buffered( return async def producer() -> None: - """Read from the original generator and fill the buffer.""" + """Read from the original generator and fill the buffer. + + Note: When the buffer is full, buffer.put() will naturally wait for the consumer + to drain items. This is the intended buffering behavior and may trigger asyncio + "slow callback" warnings (typically 0.1-0.2s) which are harmless and expected. + These warnings are filtered out in the main logging configuration. + """ nonlocal producer_error generator_consumed = False try: -- 2.34.1