From e43bd83ffb22fef1bc55c629b79de9ef48606dee 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. --- 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.44.0