From 324425f5f9a9617caa081639385dbd65074b26ae Mon Sep 17 00:00:00 2001 From: Joakim Plate Date: Tue, 21 May 2024 22:47:57 +0200 Subject: [PATCH] Switch to 3 keep alive connections 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. --- haphilipsjs/__init__.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/haphilipsjs/__init__.py b/haphilipsjs/__init__.py index ca4e094..a30cc6e 100644 --- a/haphilipsjs/__init__.py +++ b/haphilipsjs/__init__.py @@ -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 @@ -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"