From 65aaf74a4f80e06b92817ac18a1084bb21e21a47 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Fri, 8 Mar 2024 07:37:19 +0000 Subject: [PATCH] Bug 33898: Alternative approach with receive frame timeout Content-Type: text/plain; charset=utf-8 See bug 33898 comment6. --- misc/workers/background_jobs_worker.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/workers/background_jobs_worker.pl b/misc/workers/background_jobs_worker.pl index 823dbab15c..5b432ec11f 100755 --- a/misc/workers/background_jobs_worker.pl +++ b/misc/workers/background_jobs_worker.pl @@ -73,6 +73,7 @@ my ( $help, @queues ); my $max_processes = $ENV{MAX_PROCESSES}; $max_processes ||= C4::Context->config('background_jobs_worker')->{max_processes} if C4::Context->config('background_jobs_worker'); $max_processes ||= 1; +my $mq_timeout = $ENV{MQ_TIMEOUT} // 10; my $not_found_retries = {}; my $max_retries = $ENV{MAX_RETRIES} || 10; @@ -114,9 +115,10 @@ if ( $conn ) { } while (1) { if ( $conn ) { - my $frame = $conn->receive_frame; + my $frame = $conn->receive_frame( { timeout => $mq_timeout } ); if ( !defined $frame ) { - # maybe log connection problems + # timeout or connection issue? + $pm->reap_finished_children; next; # will reconnect automatically } -- 2.30.2