diff --git a/misc/workers/es_indexer_daemon.pl b/misc/workers/es_indexer_daemon.pl index cf74608b94..374e639fd6 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) {