Start thread that will handle SIGCHLD for on_reload callback (#2898)

Close #2897
This commit is contained in:
Alexander Kukushkin
2023-10-10 09:54:24 +02:00
committed by GitHub
parent e19a8730ea
commit 9b8c40a6e1
2 changed files with 4 additions and 1 deletions
+3 -1
View File
@@ -30,7 +30,9 @@ class OnReloadExecutor(CancellableSubprocess):
self.cancel(kill=True)
self._kill_children()
with self._lock:
self._start_process(cmd, close_fds=True)
started = self._start_process(cmd, close_fds=True)
if started and self._process is not None:
Thread(target=self._process.wait).start()
class CallbackExecutor(CancellableExecutor, Thread):
+1
View File
@@ -35,5 +35,6 @@ class TestCallbackExecutor(unittest.TestCase):
ce._invoke_excepthook = Mock()
self.assertIsNone(ce.call(callback))
mock_popen.side_effect = [Mock()]
self.assertIsNone(ce.call(['test.sh', 'on_reload', 'replica', 'foo']))
ce.join()