Skip to content

Commit

Permalink
Merge pull request #36 from elupus/keep_alive
Browse files Browse the repository at this point in the history
Switch to 3 keep alive connections
  • Loading branch information
elupus authored May 21, 2024
2 parents 8d9524f + 324425f commit 2f25bc4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions haphilipsjs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,8 @@ def __init__(
password=None,
verify=False,
auth_shared_key=None,
system = None
system = None,
limits = None,
):
self._host = host
self._connfail = 0
Expand Down Expand Up @@ -261,7 +262,8 @@ def __init__(
self.protocol = "http"

timeout = httpx.Timeout(timeout=TIMEOUT, connect=TIMEOUT_CONNECT)
limits = httpx.Limits(max_keepalive_connections=0, max_connections=3)
if limits is None:
limits = httpx.Limits(max_keepalive_connections=3, max_connections=3)
self.session = httpx.AsyncClient(limits=limits, timeout=timeout, verify=False)
self.session.headers["Accept"] = "application/json"

Expand Down

0 comments on commit 2f25bc4

Please sign in to comment.