Skip to content

Commit

Permalink
fix(client): only call .close() when needed (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] committed Jan 9, 2025
1 parent 39eeb9c commit 91d9a14
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/honcho/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,9 @@ def __init__(self, **kwargs: Any) -> None:

class SyncHttpxClientWrapper(DefaultHttpxClient):
def __del__(self) -> None:
if self.is_closed:
return

try:
self.close()
except Exception:
Expand Down Expand Up @@ -1334,6 +1337,9 @@ def __init__(self, **kwargs: Any) -> None:

class AsyncHttpxClientWrapper(DefaultAsyncHttpxClient):
def __del__(self) -> None:
if self.is_closed:
return

try:
# TODO(someday): support non asyncio runtimes here
asyncio.get_running_loop().create_task(self.aclose())
Expand Down

0 comments on commit 91d9a14

Please sign in to comment.