From ca6e19c2c0b05534fcab14086fb75d1ed5428454 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 --- 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 89e3b5cb0f0..ee434afea4d 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', queue => 'elastic_index' } )->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/queue", $args->{job_id} ); next; } -- 2.41.0