mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-12 00:36:03 +00:00
feat: 彻底移除 yirimirai
This commit is contained in:
@@ -125,3 +125,10 @@ class Application:
|
||||
except Exception as e:
|
||||
self.logger.error(f"应用运行致命异常: {e}")
|
||||
self.logger.debug(f"Traceback: {traceback.format_exc()}")
|
||||
|
||||
async def scoped_shutdown(self, scopes: list[str]):
|
||||
pass
|
||||
|
||||
async def shutdown(self):
|
||||
for task in self.task_mgr.tasks:
|
||||
task.cancel()
|
||||
|
||||
@@ -53,13 +53,17 @@ async def main(loop: asyncio.AbstractEventLoop):
|
||||
# 挂系统信号处理
|
||||
import signal
|
||||
|
||||
ap: app.Application
|
||||
|
||||
def signal_handler(sig, frame):
|
||||
print("[Signal] 程序退出.")
|
||||
# ap.shutdown()
|
||||
os._exit(0)
|
||||
|
||||
signal.signal(signal.SIGINT, signal_handler)
|
||||
|
||||
app_inst = await make_app(loop)
|
||||
ap = app_inst
|
||||
await app_inst.run()
|
||||
except Exception as e:
|
||||
traceback.print_exc()
|
||||
|
||||
@@ -154,6 +154,9 @@ class TaskWrapper:
|
||||
"result": self.assume_result().__str__() if self.assume_result() is not None else None,
|
||||
},
|
||||
}
|
||||
|
||||
def cancel(self):
|
||||
self.task.cancel()
|
||||
|
||||
|
||||
class AsyncTaskManager:
|
||||
|
||||
Reference in New Issue
Block a user