From d2b03384cb4203a78f6251872248e6313ce28b8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Cohen=20Arazi?= Date: Tue, 16 Sep 2025 15:13:22 -0300 Subject: [PATCH] Bug 40820: (follow-up) es_indexer_daemon.pl missed on 34070 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The es_indexer_daemon.pl was missing handling for the case where Koha::BackgroundJob->connect() returns undef without throwing an exception (which happens when connection fails silently). This adds the missing warning for that case, matching the behavior in background_jobs_worker.pl. Test plan: 1. Set JobsNotificationMethod to 'STOMP' 2. Configure invalid STOMP settings that cause connect() to return undef 3. Run es_indexer_daemon.pl - should show connection warning 4. Verify jobs are still processed via database polling Signed-off-by: Tomás Cohen Arazi --- misc/workers/es_indexer_daemon.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/misc/workers/es_indexer_daemon.pl b/misc/workers/es_indexer_daemon.pl index 9b69fb59f7..37d433f4cc 100755 --- a/misc/workers/es_indexer_daemon.pl +++ b/misc/workers/es_indexer_daemon.pl @@ -83,13 +83,15 @@ my $logger = Koha::Logger->get( { interface => 'worker' } ); my $notification_method = C4::Context->preference('JobsNotificationMethod') // 'STOMP'; -my $conn; +my ( $conn, $error ); if ( $notification_method eq 'STOMP' ) { 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; } if ($conn) { -- 2.51.0