From bc6548c5e13fa78210389756caddd004f0858efd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 12 Mar 2025 16:20:00 +0100 Subject: [PATCH] Bug 34070: Display the 'jobs will be processed anyway' message from worker ->connect does not raise an exception, so we didn't reached the catch block. Adjusting the code but I am not really happy with it, but more changes will derail the original bug Now we log: Cannot connect to broker (Access refused for user 'guest') at /kohadevbox/koha/Koha/BackgroundJob.pm line 96. Cannot connect to the message broker, the jobs will be processed anyway at /kohadevbox/koha/misc/workers/background_jobs_worker.pl line 100. Signed-off-by: Jonathan Druart Signed-off-by: Marcel de Rooy Signed-off-by: Katrin Fischer (cherry picked from commit 8dfb19a45a1ff513c2a73e198840e9f579631a2c) Signed-off-by: Fridolin Somers --- 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 8ba6ffcdd2..d794ab8f70 100755 --- a/misc/workers/background_jobs_worker.pl +++ b/misc/workers/background_jobs_worker.pl @@ -90,12 +90,14 @@ unless (@queues) { push @queues, 'default'; } -my $conn; +my ( $conn, $error ); try { $conn = Koha::BackgroundJob->connect; } catch { - warn sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_; + $error = sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_; }; +$error ||= "Cannot connect to the message broker, the jobs will be processed anyway" unless $conn; +warn $error if $error; my $pm = Parallel::ForkManager->new($max_processes);