mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-01-27 10:20:10 +00:00
Rest api thread can raise an exception during shutdown (#711)
catch it and report
This commit is contained in:
committed by
GitHub
parent
41e5f58f2b
commit
8a3b78ca7b
@@ -129,7 +129,10 @@ class Patroni(object):
|
||||
signal.signal(signal.SIGTERM, self.sigterm_handler)
|
||||
|
||||
def shutdown(self):
|
||||
self.api.shutdown()
|
||||
try:
|
||||
self.api.shutdown()
|
||||
except Exception:
|
||||
logger.exception('Exception during RestApi.shutdown')
|
||||
self.ha.shutdown()
|
||||
|
||||
|
||||
|
||||
@@ -151,3 +151,7 @@ class TestPatroni(unittest.TestCase):
|
||||
self.assertTrue(self.p.nosync)
|
||||
self.p.tags['nosync'] = None
|
||||
self.assertFalse(self.p.nosync)
|
||||
|
||||
def test_shutdown(self):
|
||||
self.p.api.shutdown = Mock(side_effect=Exception)
|
||||
self.p.shutdown()
|
||||
|
||||
Reference in New Issue
Block a user