Bugzilla – Attachment 164231 Details for
Bug 36484
Even with RabbitMQ enabled, we should should poll the database for update_elastic_index jobs at koha-es-indexer startup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36484: Fetch all outstanding (New) update_elastic_index background jobs upon starting koha-es-indexer
Bug-36484-Fetch-all-outstanding-New-updateelastici.patch (text/plain), 1.98 KB, created by
Alex Buckley
on 2024-04-02 04:54:15 UTC
(
hide
)
Description:
Bug 36484: Fetch all outstanding (New) update_elastic_index background jobs upon starting koha-es-indexer
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2024-04-02 04:54:15 UTC
Size:
1.98 KB
patch
obsolete
>From 8deefd6a2ac8d15e6ce935ad9dd867c1994dd584 Mon Sep 17 00:00:00 2001 >From: Alex Buckley <alexbuckley@catalyst.net.nz> >Date: Mon, 26 Feb 2024 09:33:00 +0000 >Subject: [PATCH] Bug 36484: Fetch all outstanding (New) update_elastic_index > background jobs upon starting koha-es-indexer > >Test plan: >1. Ensure your Koha instance is using Elasticsearch >2. Apply patches >3. sudo koha-es-indexer --stop <instance> >4. Add a new biblio record in your Koha instance >5. Query your database and ensure there is one outstanding update_elastic_index job > in background_jobs: >SELECT * FROM background_jobs WHERE type = 'update_elastic_index' AND >status = 'new'; > >6. Start services: sud service koha-common start >7. Repeat step 5 and observe the outstanding job is not returned by the > query - that is because it has been processed. > >Sponsored-by: Toi Ohomai Institute of Technology, New Zealand >--- > misc/workers/es_indexer_daemon.pl | 10 +++++++++- > 1 file changed, 9 insertions(+), 1 deletion(-) > >diff --git a/misc/workers/es_indexer_daemon.pl b/misc/workers/es_indexer_daemon.pl >index 9e900b7195c..0deefac989a 100755 >--- a/misc/workers/es_indexer_daemon.pl >+++ b/misc/workers/es_indexer_daemon.pl >@@ -91,6 +91,7 @@ try { > }; > > if ( $conn ) { >+ process_outstanding(); > # FIXME cf note in Koha::BackgroundJob about $namespace > my $namespace = C4::Context->config('memcached_namespace'); > $conn->subscribe( >@@ -132,7 +133,6 @@ while (1) { > } > > my $job = Koha::BackgroundJobs->find( $args->{job_id} ); >- > if ( $job && $job->status ne 'new' ) { > Koha::Logger->get( { interface => 'worker' } ) > ->warn( sprintf "Job %s has wrong status %s", $args->{job_id}, $job->status ); >@@ -238,3 +238,11 @@ sub commit { > ended_on => \'NOW()', > }); > } >+ >+sub process_outstanding { >+ my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => 'elastic_index' }); >+ while ( my $job = $jobs->next ) { >+ commit($job); >+ } >+ return 1; >+} >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 36484
: 164231 |
167499