mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-07-29 18:13:56 +08:00
Merge pull request #1059 from xinnan-tech/server_tts_test
update:优化吞音问题,解决播放长音频时的错误退出
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user