mirror of
https://github.com/langbot-app/LangBot.git
synced 2025-11-25 19:37:36 +08:00
perf: make launch notes show async
This commit is contained in:
@@ -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 for ret in note_inst.yield_note():
|
|
||||||
if not ret:
|
async def ayield_note(note_inst: note.LaunchNote):
|
||||||
continue
|
async for ret in note_inst.yield_note():
|
||||||
msg, level = ret
|
if not ret:
|
||||||
if msg:
|
continue
|
||||||
ap.logger.log(level, msg)
|
msg, level = ret
|
||||||
|
if msg:
|
||||||
|
ap.logger.log(level, msg)
|
||||||
|
|
||||||
|
asyncio.create_task(ayield_note(note_inst))
|
||||||
except Exception:
|
except Exception:
|
||||||
continue
|
continue
|
||||||
|
|||||||
Reference in New Issue
Block a user