From d8721bbc3687b13cd95abdcb73b3b7f9576e8190 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 17 Mar 2023 14:22:24 +0000 Subject: [PATCH] Bug 32594: Mark jobs as started and finished Signed-off-by: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- misc/workers/es_indexer_daemon.pl | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/misc/workers/es_indexer_daemon.pl b/misc/workers/es_indexer_daemon.pl index 3acfc6e252..89e3b5cb0f 100755 --- a/misc/workers/es_indexer_daemon.pl +++ b/misc/workers/es_indexer_daemon.pl @@ -151,6 +151,15 @@ sub commit { my @bib_records; my @auth_records; + + my $jobs = Koha::BackgroundJobs->search( { id => [ map { $_->id } @jobs ] }); + # Start + $jobs->update({ + progress => 0, + status => 'started', + started_on => \'NOW()', + }); + for my $job (@jobs) { my $args = try { $job->json->decode( $job->data ); @@ -182,5 +191,10 @@ sub commit { }; } - Koha::BackgroundJobs->search( { id => [ map { $_->id } @jobs ] } )->update( { status => 'finished', progress => 1 }, { no_triggers => 1 } ); + # Finish + $jobs->update({ + progress => 1, + status => 'finished', + ended_on => \'NOW()', + }); } -- 2.39.5