Skip to content

Commit f86f1d7

Browse files
committed
fix: 启动适配器时报错也能正常退出
1 parent 1f81416 commit f86f1d7

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bot.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,13 @@ def _setup(self):
4949
self.driver.on_startup(self._startup)
5050

5151
async def _startup(self):
52-
await super()._startup()
52+
try:
53+
await super()._startup()
54+
except:
55+
logger.exception("启动 GitHub 适配器时出现异常")
56+
driver = cast(Driver, self.driver)
57+
driver.should_exit.set()
58+
return
5359
# 完成启动后创建任务处理 GitHub Action 事件
5460
asyncio.create_task(handle_github_action_event())
5561

0 commit comments

Comments
 (0)