From 4548d480687473b762ba63c5733aacc70a681c9f Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Thu, 11 Apr 2024 10:33:28 +0200 Subject: [PATCH] Bug 30897: Remove recursive parent identification loop We believe that plack will only spawn from one parent and children cannot spawn further child processes.. as such we don't need to walk up the tree. Signed-off-by: Nick Clemens --- Koha/Plugins.pm | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Koha/Plugins.pm b/Koha/Plugins.pm index 88c51a5e6f4..2b4c07956e6 100644 --- a/Koha/Plugins.pm +++ b/Koha/Plugins.pm @@ -366,16 +366,9 @@ sub _restart_after_change { return unless ( C4::Context->config('plugins_restart') && C4::Context->psgi_env ); - my $parent_pid = getpid(); - my $ppid = getppid(); # Get the parent process ID + my $parent_pid = getppid(); - # If the current process is not Plack parent, find the parent process recursively - while ( $parent_pid != $ppid ) { - $parent_pid = $ppid; - $ppid = getppid(); - } - - # Send SIGUSR1 signal to Plack parent process for graceful restart + # Send HUP signal to Plack parent process for graceful restart kill 'HUP', $parent_pid; } -- 2.39.2