[patch] 重连机制新增is_reconnect参数
This commit is contained in:
@@ -143,7 +143,7 @@ class BackendClient:
|
||||
await asyncio.sleep(0.5)
|
||||
|
||||
# 发送连接状态通知给后端
|
||||
self._notify_connection_status(True)
|
||||
self._notify_connection_status(True, is_reconnect=was_reconnecting)
|
||||
|
||||
self.on_connected(was_reconnecting)
|
||||
|
||||
@@ -389,7 +389,7 @@ class BackendClient:
|
||||
import traceback
|
||||
self._log(f"详细错误: {traceback.format_exc()}", "DEBUG")
|
||||
|
||||
def _notify_connection_status(self, connected: bool):
|
||||
def _notify_connection_status(self, connected: bool, is_reconnect: bool = False):
|
||||
"""通知后端连接状态变化"""
|
||||
try:
|
||||
if not self.loop:
|
||||
@@ -415,11 +415,15 @@ class BackendClient:
|
||||
self._log(f"获取活跃平台信息失败: {e}", "DEBUG")
|
||||
|
||||
status_message = {
|
||||
"type": "connection_status",
|
||||
"type": "connection_status",
|
||||
"status": connected,
|
||||
"timestamp": int(time.time()),
|
||||
"client_uuid": self.uuid
|
||||
}
|
||||
|
||||
# 🔥 新增:如果是重连,添加重连标识
|
||||
if is_reconnect:
|
||||
status_message["is_reconnect"] = True
|
||||
|
||||
# 如果有活跃平台,添加store_id
|
||||
if active_store_id:
|
||||
|
||||
Reference in New Issue
Block a user