From 2391ff9cf79eaf58a6eb42a43cb8f64a3d447c96 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Sat, 3 Aug 2024 13:33:33 -0400 Subject: [PATCH 1/3] fail when repository cannot init --- pycsw/server.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pycsw/server.py b/pycsw/server.py index cb3fad13c..926cf3f50 100644 --- a/pycsw/server.py +++ b/pycsw/server.py @@ -424,7 +424,9 @@ def dispatch(self, writer=sys.stdout, write_headers=True): connection_done = True except: LOGGER.debug(f'Repository not loaded retry connection {max_attempts}') + LOGGER.debug(f"{self.config['repository']['database']}") max_attempts += 1 + raise except Exception as err: msg = 'Could not load repository (local): %s' % err LOGGER.exception(msg) From 0bd11f5db2f2f7aa6ec00f0b3dd72eaef6ad4aa5 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Sat, 3 Aug 2024 13:38:48 -0400 Subject: [PATCH 2/3] fail fast --- pycsw/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pycsw/server.py b/pycsw/server.py index 926cf3f50..cca78085b 100644 --- a/pycsw/server.py +++ b/pycsw/server.py @@ -424,9 +424,9 @@ def dispatch(self, writer=sys.stdout, write_headers=True): connection_done = True except: LOGGER.debug(f'Repository not loaded retry connection {max_attempts}') - LOGGER.debug(f"{self.config['repository']['database']}") max_attempts += 1 - raise + if not connection_done: + raise except Exception as err: msg = 'Could not load repository (local): %s' % err LOGGER.exception(msg) From a2899098531aa02171018dd2f3a4abbc29a7bb07 Mon Sep 17 00:00:00 2001 From: Tom Kralidis Date: Sat, 3 Aug 2024 13:52:42 -0400 Subject: [PATCH 3/3] fail on last --- pycsw/server.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pycsw/server.py b/pycsw/server.py index cca78085b..403c77119 100644 --- a/pycsw/server.py +++ b/pycsw/server.py @@ -425,8 +425,8 @@ def dispatch(self, writer=sys.stdout, write_headers=True): except: LOGGER.debug(f'Repository not loaded retry connection {max_attempts}') max_attempts += 1 - if not connection_done: - raise + if max_attempts == self.max_retries: + raise except Exception as err: msg = 'Could not load repository (local): %s' % err LOGGER.exception(msg)