Bug 40820: (follow-up) es_indexer_daemon.pl missed on 34070

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 <tomascohen@theke.io>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 9ca0e183b5)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Tomás Cohen Arazi 2025-09-16 15:13:22 -03:00 committed by Paul Derscheid
parent c9f4566aa6
commit f39c370980
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
1 changed files with 4 additions and 2 deletions

View File

@ -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) {