Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Fix unclosed github client (#5733)

Robert Brennanf54d953fe1a5
diff --git a/openhands/server/listen_socket.py b/openhands/server/listen_socket.py
index 8943484ad2..d0c917fad5 100644
--- a/openhands/server/listen_socket.py
+++ b/openhands/server/listen_socket.py
@@ -33,9 +33,9 @@ async def connect(connection_id: str, environ, auth):
user_id = ''
if auth and 'github_token' in auth:
- g = Github(auth['github_token'])
- gh_user = await call_sync_from_async(g.get_user)
- user_id = gh_user.id
+ with Github(auth['github_token']) as g:
+ gh_user = await call_sync_from_async(g.get_user)
+ user_id = gh_user.id
logger.info(f'User {user_id} is connecting to conversation {conversation_id}')