This is an automated email from the ASF dual-hosted git repository. kmarlis pushed a commit to branch SDAP-515 in repository https://gitbox.apache.org/repos/asf/sdap-nexus.git
commit 63e05cb947882f6384db0fffbcbc09db6833f687 Author: kevinmarlis <[email protected]> AuthorDate: Thu May 2 08:46:17 2024 -0700 Improved error handling to account for any reason a remote is not reachable --- analysis/webservice/redirect/RemoteSDAPCache.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/analysis/webservice/redirect/RemoteSDAPCache.py b/analysis/webservice/redirect/RemoteSDAPCache.py index 3b8c772..9c9d658 100644 --- a/analysis/webservice/redirect/RemoteSDAPCache.py +++ b/analysis/webservice/redirect/RemoteSDAPCache.py @@ -38,7 +38,10 @@ class RemoteSDAPCache: def _add(self, url, timeout=2, max_age=3600*24): list_url = f"{url}/list" try: - r = requests.get(list_url, timeout=timeout) + try: + r = requests.get(list_url, timeout=timeout) + except Exception as e: + raise CollectionNotFound(f'URL {list_url} was not reachable') if r.status_code == 200: logger.info("Caching list for sdap %s: %s", list_url, r.text) self.sdap_lists[url] = RemoteSDAPList( @@ -47,8 +50,8 @@ class RemoteSDAPCache: ) else: raise CollectionNotFound(f"url {list_url} was not reachable, responded with status {r.status_code}") - except (requests.exceptions.ConnectTimeout, requests.exceptions.ReadTimeout) as e: - raise CollectionNotFound(f"url {list_url} was not reachable in {timeout} s") + except CollectionNotFound as e: + logger.info(f'URL {url} is unreachable. Skipping. {e}') def get(self, url, short_name): stripped_url = url.strip('/')
