diff --git a/patroni/__init__.py b/patroni/__init__.py index d5fd9464..2d0bc01c 100644 --- a/patroni/__init__.py +++ b/patroni/__init__.py @@ -159,7 +159,10 @@ class Patroni(object): self.api.shutdown() except Exception: logger.exception('Exception during RestApi.shutdown') - self.ha.shutdown() + try: + self.ha.shutdown() + except Exception: + logger.exception('Exception during Ha.shutdown') self.logger.shutdown() diff --git a/tests/test_patroni.py b/tests/test_patroni.py index 1611d970..0b395d59 100644 --- a/tests/test_patroni.py +++ b/tests/test_patroni.py @@ -174,6 +174,7 @@ class TestPatroni(unittest.TestCase): @patch.object(Thread, 'join', Mock()) def test_shutdown(self): self.p.api.shutdown = Mock(side_effect=Exception) + self.p.ha.shutdown = Mock(side_effect=Exception) self.p.shutdown() def test_check_psycopg2(self):