mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-08-14 22:40:59 +00:00
fix: 群消息超时时未释放锁造成死锁
This commit is contained in:
@@ -108,7 +108,6 @@ class QQBotManager:
|
|||||||
|
|
||||||
pkg.utils.context.set_qqbot_manager(self)
|
pkg.utils.context.set_qqbot_manager(self)
|
||||||
|
|
||||||
|
|
||||||
def send(self, event, msg, check_quote=True):
|
def send(self, event, msg, check_quote=True):
|
||||||
asyncio.run(
|
asyncio.run(
|
||||||
self.bot.send(event, msg, quote=True if hasattr(config,
|
self.bot.send(event, msg, quote=True if hasattr(config,
|
||||||
@@ -166,11 +165,13 @@ class QQBotManager:
|
|||||||
event.sender.id)
|
event.sender.id)
|
||||||
break
|
break
|
||||||
except FunctionTimedOut:
|
except FunctionTimedOut:
|
||||||
|
pkg.openai.session.get_session('group_{}'.format(event.group.id)).release_response_lock()
|
||||||
failed += 1
|
failed += 1
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if failed == self.retry:
|
if failed == self.retry:
|
||||||
self.notify_admin("{} 请求超时".format("group_{}".format(event.sender.id)))
|
pkg.openai.session.get_session('group_{}'.format(event.group.id)).release_response_lock()
|
||||||
|
self.notify_admin("{} 请求超时".format("group_{}".format(event.group.id)))
|
||||||
replys = ["[bot]err:请求超时"]
|
replys = ["[bot]err:请求超时"]
|
||||||
|
|
||||||
return replys
|
return replys
|
||||||
@@ -195,5 +196,3 @@ class QQBotManager:
|
|||||||
logging.info("通知管理员:{}".format(message))
|
logging.info("通知管理员:{}".format(message))
|
||||||
send_task = self.bot.send_friend_message(config.admin_qq, "[bot]{}".format(message))
|
send_task = self.bot.send_friend_message(config.admin_qq, "[bot]{}".format(message))
|
||||||
threading.Thread(target=asyncio.run, args=(send_task,)).start()
|
threading.Thread(target=asyncio.run, args=(send_task,)).start()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user