Skip to content

Commit

Permalink
allow http session reuse (All-Hands-AI#6478)
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren authored Jan 27, 2025
1 parent 8a65df6 commit 9611093
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions openhands/utils/http_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

import requests

from openhands.core.logger import openhands_logger as logger


@dataclass
class HttpSession:
Expand All @@ -15,10 +17,11 @@ class HttpSession:

def __getattr__(self, name):
if self.session is None:
raise ValueError('session_was_closed')
logger.error(
'Session is being used after close!', stack_info=True, exc_info=True
)
return object.__getattribute__(self.session, name)

def close(self):
if self.session is not None:
self.session.close()
self.session = None

0 comments on commit 9611093

Please sign in to comment.