From 2ecbd8c0ab1bbaeb4f2198af1ed048982c00bcb3 Mon Sep 17 00:00:00 2001 From: Maksim Ivanov Date: Mon, 16 Dec 2024 15:52:44 +0100 Subject: [PATCH] Handle browser context close event --- skyvern/webeye/persistent_sessions_manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/skyvern/webeye/persistent_sessions_manager.py b/skyvern/webeye/persistent_sessions_manager.py index 4029ad036..bc262d828 100644 --- a/skyvern/webeye/persistent_sessions_manager.py +++ b/skyvern/webeye/persistent_sessions_manager.py @@ -52,6 +52,8 @@ async def create_session( url=url, organization_id=organization_id, ) + + browser_context.on("close", lambda: self.sessions[organization_id].pop(session_id)) browser_state = BrowserState( pw=pw,