From 3c11c6012660b1392c57b065fa0e29f90ea67bdc Mon Sep 17 00:00:00 2001 From: Quentin Fuxa Date: Thu, 11 Sep 2025 21:03:00 +0200 Subject: [PATCH] fix by @treeaaa --- whisperlivekit/audio_processor.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/whisperlivekit/audio_processor.py b/whisperlivekit/audio_processor.py index 942c9ed..a9cdc15 100644 --- a/whisperlivekit/audio_processor.py +++ b/whisperlivekit/audio_processor.py @@ -635,12 +635,13 @@ class AudioProcessor: except Exception as e: logger.error(f"Error in watchdog task: {e}", exc_info=True) - async def cleanup(self): - """Clean up resources when processing is complete.""" - logger.info("Starting cleanup of AudioProcessor resources.") - for task in self.all_tasks_for_cleanup: - if task and not task.done(): - task.cancel() +async def cleanup(self): + """Clean up resources when processing is complete.""" + logger.info("Starting cleanup of AudioProcessor resources.") + self.is_stopping = True + for task in self.all_tasks_for_cleanup: + if task and not task.done(): + task.cancel() created_tasks = [t for t in self.all_tasks_for_cleanup if t] if created_tasks: