调整心跳策略。
This commit is contained in:
12
robot.py
12
robot.py
@@ -218,9 +218,9 @@ class Robot(Job):
|
|||||||
data = await self.ipad_bot.sync_message()
|
data = await self.ipad_bot.sync_message()
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.LOG.error(f"获取新消息失败 {e}")
|
self.LOG.error(f"获取新消息失败 {e}")
|
||||||
if e == "用户可能退出":
|
if "用户可能退出" in str(e):
|
||||||
self.LOG.error(f"获取新消息失败 {e},请重启应用重新登录!")
|
self.LOG.error(f"用户可能退出: {e}")
|
||||||
self.ipad_running = False
|
self.login_twice_auto_auth()
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -319,6 +319,9 @@ class Robot(Job):
|
|||||||
self.LOG.warning("心跳失败")
|
self.LOG.warning("心跳失败")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.LOG.error(f"wechat_ipad heartbeat: {e}")
|
self.LOG.error(f"wechat_ipad heartbeat: {e}")
|
||||||
|
if "用户可能退出" in str(e):
|
||||||
|
self.LOG.error(f"用户可能退出: {e}")
|
||||||
|
self.login_twice_auto_auth()
|
||||||
await asyncio.sleep(60)
|
await asyncio.sleep(60)
|
||||||
|
|
||||||
async def _heartbeat_task_long(self):
|
async def _heartbeat_task_long(self):
|
||||||
@@ -333,6 +336,9 @@ class Robot(Job):
|
|||||||
self.LOG.warning("长连接心跳失败")
|
self.LOG.warning("长连接心跳失败")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.LOG.error(f"wechat_ipad heartbeat long: {e}")
|
self.LOG.error(f"wechat_ipad heartbeat long: {e}")
|
||||||
|
if "用户可能退出" in str(e):
|
||||||
|
self.LOG.error(f"用户可能退出: {e}")
|
||||||
|
self.login_twice_auto_auth()
|
||||||
await asyncio.sleep(120)
|
await asyncio.sleep(120)
|
||||||
|
|
||||||
async def _process_ipad_message(self, message: WxMessage):
|
async def _process_ipad_message(self, message: WxMessage):
|
||||||
|
|||||||
Reference in New Issue
Block a user