Skip to content

Commit

Permalink
Switch to 3 keep alive connections
Browse files Browse the repository at this point in the history
There are indications that this may avoid backlogging
connections on certain TV's. I am not sure why it was
dis-allowed a while back. Could have been older tv's
if so let's find out.
  • Loading branch information
elupus committed May 21, 2024
1 parent a4be140 commit 324425f
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 @@ -210,7 +210,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 @@ -257,7 +258,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 324425f

Please sign in to comment.