From bb472846cd6595aefb51880bca5792a3cdba88cb Mon Sep 17 00:00:00 2001 From: Sander Peterse Date: Thu, 30 May 2024 21:04:33 +0200 Subject: [PATCH] Only add longpoll timeout to request timeout when longpoll is enabled. --- pyIndego/indego_async_client.py | 2 +- pyIndego/indego_client.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyIndego/indego_async_client.py b/pyIndego/indego_async_client.py index 704b5ee..a292b6c 100644 --- a/pyIndego/indego_async_client.py +++ b/pyIndego/indego_async_client.py @@ -417,7 +417,7 @@ async def update_state(self, force=False, longpoll=False, longpoll_timeout=120): if force: path = f"{path}%sforceRefresh=true" % ("&" if longpoll else "?") - self._update_state(await self.get(path, timeout=longpoll_timeout + 10)) + self._update_state(await self.get(path, timeout=(longpoll_timeout + 10) if longpoll else 10)) async def get_state(self, force=False, longpoll=False, longpoll_timeout=120): """Update state and return it. diff --git a/pyIndego/indego_client.py b/pyIndego/indego_client.py index cc0a612..442148f 100644 --- a/pyIndego/indego_client.py +++ b/pyIndego/indego_client.py @@ -345,7 +345,7 @@ def update_state(self, force=False, longpoll=False, longpoll_timeout=120): else: path = f"{path}?forceRefresh=true" - self._update_state(self.get(path, timeout=longpoll_timeout + 30)) + self._update_state(self.get(path, timeout=(longpoll_timeout + 10) if longpoll else 10)) def get_state(self, force=False, longpoll=False, longpoll_timeout=120): """Update state. Can be both forced and with longpoll.