From 896fef8cce2d2c5e7c31b1209cd116d0720871f2 Mon Sep 17 00:00:00 2001 From: Junyan Qin Date: Mon, 30 Jun 2025 21:34:02 +0800 Subject: [PATCH] perf: make launch notes show async --- pkg/core/stages/show_notes.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkg/core/stages/show_notes.py b/pkg/core/stages/show_notes.py index e7c98b42..5fa7ff08 100644 --- a/pkg/core/stages/show_notes.py +++ b/pkg/core/stages/show_notes.py @@ -1,5 +1,7 @@ from __future__ import annotations +import asyncio + from .. import stage, app, note from ...utils import importutil @@ -20,11 +22,15 @@ class ShowNotesStage(stage.BootingStage): try: note_inst = note_cls(ap) if await note_inst.need_show(): - async for ret in note_inst.yield_note(): - if not ret: - continue - msg, level = ret - if msg: - ap.logger.log(level, msg) + + async def ayield_note(note_inst: note.LaunchNote): + async for ret in note_inst.yield_note(): + if not ret: + continue + msg, level = ret + if msg: + ap.logger.log(level, msg) + + asyncio.create_task(ayield_note(note_inst)) except Exception: continue