Skip to content

Commit

Permalink
Prevent double close in HTTP client __del__
Browse files Browse the repository at this point in the history
  • Loading branch information
piotrm-nvidia committed Feb 6, 2024
1 parent 1dc9836 commit 0f476ad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/python/library/tritonclient/http/_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ def __init__(
)
self._pool = gevent.pool.Pool(max_greenlets)
self._verbose = verbose
self._closed = False

def __enter__(self):
return self
Expand All @@ -205,8 +206,10 @@ def close(self):
will result in an Error.
"""
self._pool.join()
self._client_stub.close()
if not self._closed:
self._pool.join()
self._client_stub.close()
self._closed = True

def _get(self, request_uri, headers, query_params):
"""Issues the GET request to the server
Expand Down

0 comments on commit 0f476ad

Please sign in to comment.