feat: change standalone runtime tag env

This commit is contained in:
Junyan Qin
2025-08-23 22:57:46 +08:00
parent b5e22c6db8
commit 2742144e12
2 changed files with 8 additions and 2 deletions

View File

@@ -51,7 +51,7 @@ class PluginRuntimeConnector:
async def initialize(self):
async def new_connection_callback(connection: base_connection.Connection):
async def disconnect_callback(rchandler: handler.RuntimeConnectionHandler) -> bool:
if platform.get_platform() == 'docker':
if platform.get_platform() == 'docker' or platform.use_websocket_to_connect_plugin_runtime():
self.ap.logger.error('Disconnected from plugin runtime, trying to reconnect...')
await self.runtime_disconnect_callback(self)
return False
@@ -69,7 +69,7 @@ class PluginRuntimeConnector:
task: asyncio.Task | None = None
if platform.get_platform() == 'docker': # use websocket
if platform.get_platform() == 'docker' or platform.use_websocket_to_connect_plugin_runtime(): # use websocket
self.ap.logger.info('use websocket to connect to plugin runtime')
ws_url = self.ap.instance_config.data['plugin']['runtime_ws_url']

View File

@@ -12,3 +12,9 @@ def get_platform() -> str:
return 'docker'
return sys.platform
def use_websocket_to_connect_plugin_runtime() -> bool:
"""是否使用 websocket 连接插件运行时"""
STANDALONE_RUNTIME = os.environ.get('STANDALONE_RUNTIME', 'false')
return STANDALONE_RUNTIME == 'true'