feat: 持久化和 web 接口基础架构

This commit is contained in:
RockChinQ
2024-10-11 22:27:53 +08:00
parent 21f153e5c3
commit 7c3557e943
26 changed files with 462 additions and 22 deletions

View File

@@ -1,6 +1,7 @@
from __future__ import print_function
import traceback
import asyncio
from . import app
from ..audit import identifier
@@ -19,13 +20,15 @@ stage_order = [
]
async def make_app() -> app.Application:
async def make_app(loop: asyncio.AbstractEventLoop) -> app.Application:
# 生成标识符
identifier.init()
ap = app.Application()
ap.event_loop = loop
# 执行启动阶段
for stage_name in stage_order:
stage_cls = stage.preregistered_stages[stage_name]
@@ -38,9 +41,9 @@ async def make_app() -> app.Application:
return ap
async def main():
async def main(loop: asyncio.AbstractEventLoop):
try:
app_inst = await make_app()
app_inst = await make_app(loop)
await app_inst.run()
except Exception as e:
traceback.print_exc()