diff --git a/src/langbot/pkg/core/app.py b/src/langbot/pkg/core/app.py index 79459b706..f1bff1c5b 100644 --- a/src/langbot/pkg/core/app.py +++ b/src/langbot/pkg/core/app.py @@ -326,10 +326,13 @@ class Application: async def run(self): self.event_loop_monitor.start() try: - if self.directory_projection_service is not None and getattr(self, "directory_projection_task", None) is None: + if ( + self.directory_projection_service is not None + and getattr(self, 'directory_projection_task', None) is None + ): self.directory_projection_task = self.task_mgr.create_task( self.directory_projection_service.run(), - name="cloud-directory-projection", + name='cloud-directory-projection', scopes=[core_entities.LifecycleControlScope.APPLICATION], ) if self.cloud_model_catalog_service is not None: @@ -344,6 +347,7 @@ class Application: name='cloud-manifest-refresh', scopes=[core_entities.LifecycleControlScope.APPLICATION], ) + # 后续可能会允许动态重启其他任务 # 故为了防止程序在非 Ctrl-C 情况下退出,这里创建一个不会结束的协程 async def never_ending(): diff --git a/src/langbot/pkg/core/stages/build_app.py b/src/langbot/pkg/core/stages/build_app.py index fed6031fc..7941a5553 100644 --- a/src/langbot/pkg/core/stages/build_app.py +++ b/src/langbot/pkg/core/stages/build_app.py @@ -298,7 +298,7 @@ class BuildAppStage(stage.BootingStage): # its long-lived tasks, so start the single refresh task here. ap.directory_projection_task = ap.task_mgr.create_task( ap.directory_projection_service.run(), - name="cloud-directory-projection", + name='cloud-directory-projection', scopes=[core_entities.LifecycleControlScope.APPLICATION], ) diff --git a/src/langbot/pkg/plugin/connector.py b/src/langbot/pkg/plugin/connector.py index bcdf4fe8e..03893cf4c 100644 --- a/src/langbot/pkg/plugin/connector.py +++ b/src/langbot/pkg/plugin/connector.py @@ -701,7 +701,9 @@ class PluginRuntimeConnector(ManagedRuntimeConnector): } self._known_desired_states.update({state.binding.installation_uuid: state for state in desired_states}) - reconcile_timeout_seconds = max(300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get("plugin", {}))) + reconcile_timeout_seconds = max( + 300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get('plugin', {})) + ) result = await runtime_handler.reconcile_plugin_installations( tuple(self._known_desired_states.values()), timeout=reconcile_timeout_seconds, @@ -740,7 +742,9 @@ class PluginRuntimeConnector(ManagedRuntimeConnector): if state.binding.installation_uuid in all_states: raise ValueError('Duplicate plugin installation UUID across projected Workspaces') all_states[state.binding.installation_uuid] = state - reconcile_timeout_seconds = max(300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get("plugin", {}))) + reconcile_timeout_seconds = max( + 300.0, self._runtime_connect_timeout(self.ap.instance_config.data.get('plugin', {})) + ) result = await runtime_handler.reconcile_plugin_installations( tuple(all_states.values()), timeout=reconcile_timeout_seconds,