From f8f6799593970d3f30788f6221fdcc5ebef57cd4 Mon Sep 17 00:00:00 2001 From: Alessio Fabiani Date: Mon, 20 Mar 2023 12:32:28 +0100 Subject: [PATCH] =?UTF-8?q?[Fixes=20#10790]=20GeoNode=20"HttpClient"=20not?= =?UTF-8?q?=20catching=20the=20Connection=20Timeo=E2=80=A6=20(#10791)=20(#?= =?UTF-8?q?10806)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [Fixes #10790] GeoNode "HttpClient" not catching the Connection Timeout and therefore causes UWSGI to die * Black formatting (cherry picked from commit bf21b6593b25ed66da45bae0bd5bc64f20a29a28) # Conflicts: # geonode/utils.py --- geonode/utils.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/geonode/utils.py b/geonode/utils.py index 6c38fa6fc29..c1ce5e3fadb 100755 --- a/geonode/utils.py +++ b/geonode/utils.py @@ -1193,14 +1193,13 @@ def request(self, url, method='GET', data=None, headers={}, stream=False, if action: _req_tout = timeout or self.timeout try: - response = action( - url=url, - data=data, - headers=headers, - timeout=_req_tout, - stream=stream, - verify=verify) - except (requests.exceptions.RequestException, ValueError, RetryError) as e: + response = action(url=url, data=data, headers=headers, timeout=_req_tout, stream=stream, verify=verify) + except ( + requests.exceptions.ConnectTimeout, + requests.exceptions.RequestException, + ValueError, + RetryError, + ) as e: msg = f"Request exception [{e}] - TOUT [{_req_tout}] to URL: {url} - headers: {headers}" logger.exception(Exception(msg)) response = None