如果用户可能退出,则不发送相关请求
This commit is contained in:
7
robot.py
7
robot.py
@@ -218,6 +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.warning(f"获取新消息失败 {e}")
|
self.LOG.warning(f"获取新消息失败 {e}")
|
||||||
|
if e == "用户可能退出":
|
||||||
|
self.LOG.error(f"获取新消息失败 {e},请重启应用重新登录!")
|
||||||
|
self.ipad_running = False
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@@ -312,10 +315,8 @@ class Robot(Job):
|
|||||||
else:
|
else:
|
||||||
self.LOG.warning("心跳失败")
|
self.LOG.warning("心跳失败")
|
||||||
self.LOG.error(f"wechat_ipad heartbeat heartbeat twice_auto_auth ")
|
self.LOG.error(f"wechat_ipad heartbeat heartbeat twice_auto_auth ")
|
||||||
self.login_twice_auto_auth()
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.LOG.error(f"wechat_ipad heartbeat: {e}")
|
self.LOG.error(f"wechat_ipad heartbeat: {e}")
|
||||||
self.login_twice_auto_auth()
|
|
||||||
await asyncio.sleep(5)
|
await asyncio.sleep(5)
|
||||||
|
|
||||||
async def _heartbeat_task_long(self):
|
async def _heartbeat_task_long(self):
|
||||||
@@ -329,10 +330,8 @@ class Robot(Job):
|
|||||||
else:
|
else:
|
||||||
self.LOG.warning("长连接心跳失败")
|
self.LOG.warning("长连接心跳失败")
|
||||||
self.LOG.error(f"wechat_ipad heartbeat long twice_auto_auth ")
|
self.LOG.error(f"wechat_ipad heartbeat long twice_auto_auth ")
|
||||||
self.login_twice_auto_auth()
|
|
||||||
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}")
|
||||||
self.login_twice_auto_auth()
|
|
||||||
await asyncio.sleep(30)
|
await asyncio.sleep(30)
|
||||||
|
|
||||||
async def _process_ipad_message(self, message: WxMessage):
|
async def _process_ipad_message(self, message: WxMessage):
|
||||||
|
|||||||
Reference in New Issue
Block a user