π OpenHands: AI-Driven Development
Run runtime.close in background thread (#7524)
tofarrc5491e87aa8d
diff --git a/openhands/server/session/agent_session.py b/openhands/server/session/agent_session.pyindex f2a22235c6..27daf479fb 100644--- a/openhands/server/session/agent_session.py+++ b/openhands/server/session/agent_session.py@@ -24,7 +24,7 @@ from openhands.runtime.base import Runtimefrom openhands.runtime.impl.remote.remote_runtime import RemoteRuntimefrom openhands.security import SecurityAnalyzer, optionsfrom openhands.storage.files import FileStore-from openhands.utils.async_utils import call_sync_from_async+from openhands.utils.async_utils import EXECUTOR, call_sync_from_asyncfrom openhands.utils.shutdown_listener import should_continueWAIT_TIME_BEFORE_CLOSE = 90@@ -203,7 +203,7 @@ class AgentSession:end_state.save_to_session(self.sid, self.file_store, self.user_id)await self.controller.close()if self.runtime is not None:- self.runtime.close()+ EXECUTOR.submit(self.runtime.close)if self.security_analyzer is not None:await self.security_analyzer.close()