mirror of
https://github.com/outbackdingo/patroni.git
synced 2026-08-25 14:53:37 +00:00
Wait for callback end if it could not be killed (#985)
that could happen if the script is running under a sudo
This commit is contained in:
committed by
Alexander Kukushkin
parent
8a7ba57457
commit
13f7aede61
@@ -19,8 +19,13 @@ class CallbackExecutor(Thread):
|
||||
def call(self, cmd):
|
||||
with self._lock:
|
||||
if self._process and self._process.poll() is None:
|
||||
self._process.kill()
|
||||
logger.warning('Killed the old callback process because it was still running: %s', self._cmd)
|
||||
try:
|
||||
self._process.kill()
|
||||
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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user