From 17560ba44333f23e611f74f3879287575c116d4c Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 18 Oct 2023 13:58:17 +0000 Subject: [PATCH] Bug 32305: Counterpart for es_indexer_daemon.pl This is a kind of copy-and-paste variant of background worker. We probably could do better than having two scripts here ;) Test plan: See former test plan. Apply it to ES indexing. Signed-off-by: Marcel de Rooy Signed-off-by: Nick Clemens Signed-off-by: Martin Renvoize Signed-off-by: Marcel de Rooy [EDIT] Removed queue from query at MQ side. Discussed on IRC. Signed-off-by: Tomas Cohen Arazi (cherry picked from commit 709dabb7e8c6285d5c93ece3baed845123cd3a8e) Signed-off-by: Fridolin Somers --- misc/workers/es_indexer_daemon.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/misc/workers/es_indexer_daemon.pl b/misc/workers/es_indexer_daemon.pl index 89e3b5cb0f..b24d1902f3 100755 --- a/misc/workers/es_indexer_daemon.pl +++ b/misc/workers/es_indexer_daemon.pl @@ -122,10 +122,10 @@ while (1) { # FIXME This means we need to have create the DB entry before # It could work in a first step, but then we will want to handle job that will be created from the message received - my $job = Koha::BackgroundJobs->find($args->{job_id}); + my $job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; - unless ( $job ) { - $logger->warn(sprintf "No job found for id=%s", $args->{job_id}); + unless ($job) { + $logger->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); next; } -- 2.39.5