Merge pull request #1059 from xinnan-tech/server_tts_test

update:优化吞音问题,解决播放长音频时的错误退出
This commit is contained in:
CGD
2025-04-30 11:58:03 +08:00
committed by GitHub
2 changed files with 26 additions and 12 deletions
+7 -3
View File
@@ -203,12 +203,16 @@ class ConnectionHandler:
finally:
await self.close(ws)
async def reset_timeout(self):
"""重置超时计时器"""
if self.timeout_task:
self.timeout_task.cancel()
self.timeout_task = asyncio.create_task(self._check_timeout())
async def _route_message(self, message):
"""消息路由"""
# 重置超时计时器
if self.timeout_task:
self.timeout_task.cancel()
self.timeout_task = asyncio.create_task(self._check_timeout())
await self.reset_timeout()
if isinstance(message, str):
await handleTextMessage(self, message)