perf: make launch notes show async

This commit is contained in:
Junyan Qin
2025-06-30 21:34:02 +08:00
parent 89c1972abe
commit 896fef8cce

View File

@@ -1,5 +1,7 @@
from __future__ import annotations from __future__ import annotations
import asyncio
from .. import stage, app, note from .. import stage, app, note
from ...utils import importutil from ...utils import importutil
@@ -20,11 +22,15 @@ class ShowNotesStage(stage.BootingStage):
try: try:
note_inst = note_cls(ap) note_inst = note_cls(ap)
if await note_inst.need_show(): if await note_inst.need_show():
async def ayield_note(note_inst: note.LaunchNote):
async for ret in note_inst.yield_note(): async for ret in note_inst.yield_note():
if not ret: if not ret:
continue continue
msg, level = ret msg, level = ret
if msg: if msg:
ap.logger.log(level, msg) ap.logger.log(level, msg)
asyncio.create_task(ayield_note(note_inst))
except Exception: except Exception:
continue continue