From 51b085a76d16a1957c2bf456dba041839c5f29fc Mon Sep 17 00:00:00 2001 From: Alexander Kukushkin Date: Mon, 15 Apr 2019 15:49:06 +0200 Subject: [PATCH] Don't wait until the previous callback finish is kill failed (#1036) Such wait was happening in the main thread and blocking HA loop. After all the executor thread was doing absolutely the same. --- patroni/callback_executor.py | 2 -- tests/test_callback_executor.py | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/patroni/callback_executor.py b/patroni/callback_executor.py index 4764cae1..2d00b64c 100644 --- a/patroni/callback_executor.py +++ b/patroni/callback_executor.py @@ -24,8 +24,6 @@ class CallbackExecutor(Thread): logger.warning('Killed the old callback process because it was still running: %s', self._cmd) except OSError: logger.exception('Failed to kill the old callback') - logger.warning('Wait until callback end') - self._process.wait() self._cmd = cmd self._callback_event.set() diff --git a/tests/test_callback_executor.py b/tests/test_callback_executor.py index fc4a95c2..1b9a01a5 100644 --- a/tests/test_callback_executor.py +++ b/tests/test_callback_executor.py @@ -18,7 +18,7 @@ class TestCallbackExecutor(unittest.TestCase): self.assertIsNone(ce.call([])) mock_popen.return_value.kill.side_effect = OSError - self.assertRaises(Exception, ce.call, []) + self.assertIsNone(ce.call([])) mock_popen.side_effect = Exception ce = CallbackExecutor()