This commit is contained in:
hrz 2026-11-16 17:28:34 +08:00 committed by GitHub
commit 8008fe00ee
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View file

@ -31,6 +31,8 @@ class AudioPlugin(Plugin):
self.source.stop()
def shutdown(self) -> None:
if self.source is not None:
self.source.stop()
if self.app is not None:
self.app.audio_source = None
self.source = None

View file

@ -51,13 +51,14 @@ class TestRuntimeApplication:
logger.info("test runtime application started")
def stop(self) -> None:
if not self._is_running:
return
self.event_bridge.publish_service_stopping()
self.plugins.stop_all()
was_running = self._is_running
self._is_running = False
logger.info("test runtime application stopped")
if was_running:
self.event_bridge.publish_service_stopping()
logger.info("test runtime application stopped")
# 启动中途失败时 _is_running 还是 False,但插件可能已经开过采集流,
# 这里不提前返回,保证采集流一定被关掉
self.plugins.stop_all()
def shutdown(self) -> None:
self.stop()