fix: core_lifecycle event_bus cleanup, initialize_core sets dashboard_shutdown_event, load_pipeline_scheduler mock

This commit is contained in:
LIghtJUNction
2026-04-29 04:31:16 +08:00
parent b4034225b8
commit 10fa16e0b8
2 changed files with 8 additions and 2 deletions

View File

@@ -279,6 +279,9 @@ class AstrBotCoreLifecycle:
# Leave other runtime initializations (plugin reload, provider init, etc.)
# to `bootstrap_runtime`.
# Initialize dashboard shutdown event (matches full initialize behavior)
self.dashboard_shutdown_event = asyncio.Event()
async def bootstrap_runtime(self) -> None:
"""Compatibility method for runtime bootstrap (deferred initialization).
@@ -340,6 +343,9 @@ class AstrBotCoreLifecycle:
"Failed cleaning up plugins after runtime bootstrap failure",
)
# Reset event_bus to None so callers can detect partial init
self.event_bus = None
try:
if getattr(self, "provider_manager", None) and hasattr(
self.provider_manager,

View File

@@ -722,10 +722,10 @@ class TestAstrBotCoreLifecycleInitialize:
)
mocks["create_task"].side_effect = record_create_task
lifecycle.load_pipeline_scheduler = load_pipeline_scheduler
with patch_initialize_test_mocks(mock_astrbot_config, mocks):
await lifecycle.initialize_core()
await lifecycle.bootstrap_runtime()
assert call_order == [