feat: skip cancel monitor task

This commit is contained in:
Harold 2025-12-15 18:16:45 +08:00
parent ca7553b607
commit 91d33083da

View file

@ -438,15 +438,16 @@ class TTSProvider(TTSProviderBase):
finally: finally:
self.ws = None self.ws = None
if self._monitor_task and not self._monitor_task.done(): if not skip_cancel_monitor_task:
try: if self._monitor_task and not self._monitor_task.done():
await self._monitor_task try:
except asyncio.CancelledError: await self._monitor_task
pass except asyncio.CancelledError:
except Exception as e: pass
logger.bind(tag=TAG).warning(f"Error canceling monitor task: {e}") except Exception as e:
finally: logger.bind(tag=TAG).warning(f"Error canceling monitor task: {e}")
self._monitor_task = None finally:
self._monitor_task = None
async def _monitor_ws_response(self): async def _monitor_ws_response(self):
"""Monitor WebSocket responses - long running task (MessagePack serialization)""" """Monitor WebSocket responses - long running task (MessagePack serialization)"""