Skip to content

Commit 1e57a0d

Browse files
authored
Merge pull request #65 from cloudblue/LITE-26688-fix-async-client-memory-leaks
LITE-26688 reuse http async transport
2 parents 15c8447 + 2783f56 commit 1e57a0d

2 files changed

Lines changed: 92 additions & 89 deletions

File tree

connect/client/fluent.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ def _get_namespace_class(self):
212212
return NS
213213

214214

215+
_HTTP_TRANSPORT = httpx.AsyncHTTPTransport()
216+
217+
215218
class AsyncConnectClient(_ConnectClientBase, AsyncClientMixin):
216219
"""
217220
Create a new instance of the AsyncConnectClient.
@@ -243,7 +246,7 @@ class AsyncConnectClient(_ConnectClientBase, AsyncClientMixin):
243246
def __init__(self, *args, **kwargs):
244247
super().__init__(*args, **kwargs)
245248
self._response = contextvars.ContextVar('response', default=None)
246-
self._session = httpx.AsyncClient()
249+
self._session = httpx.AsyncClient(transport=_HTTP_TRANSPORT)
247250

248251
@property
249252
def response(self):

0 commit comments

Comments
 (0)