fix another race condition
authorMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 11 Apr 2024 13:42:45 +0000 (15:42 +0200)
committerMarcel van der Veldt <m.vanderveldt@outlook.com>
Thu, 11 Apr 2024 13:42:45 +0000 (15:42 +0200)
music_assistant/server/helpers/audio.py

index 8e70a5f2b94e182f7d7309a473193f77d517929e..3e742d66f7568bb685fca3a29ca5c31f2877297e 100644 (file)
@@ -119,8 +119,9 @@ class FFMpeg(AsyncProcess):
                 await self._stdin_task
             # make sure the stdin generator is also properly closed
             # by propagating a cancellederror within
-            task = asyncio.create_task(self.audio_input.__anext__())
-            task.cancel()
+            with suppress(RuntimeError):
+                task = asyncio.create_task(self.audio_input.__anext__())
+                task.cancel()
         if not self.collect_log_history:
             await super().close(send_signal)
             return