mirror of
https://github.com/AstrBotDevs/AstrBot
synced 2026-07-16 01:40:15 +08:00
fix: core_lifecycle event_bus cleanup, initialize_core sets dashboard_shutdown_event, load_pipeline_scheduler mock
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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 == [
|
||||
|
||||
Reference in New Issue
Block a user