Bugzilla – Attachment 148513 Details for
Bug 32594
Add a dedicated ES indexing background worker
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32594: Mark jobs as started and finished
Bug-32594-Mark-jobs-as-started-and-finished.patch (text/plain), 1.86 KB, created by
Jonathan Druart
on 2023-03-22 10:59:19 UTC
(
hide
)
Description:
Bug 32594: Mark jobs as started and finished
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-03-22 10:59:19 UTC
Size:
1.86 KB
patch
obsolete
>From 647f80e6d14abebbba094c3441dd6b32140a3572 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 22 Mar 2023 11:58:06 +0100 >Subject: [PATCH] Bug 32594: Mark jobs as started and finished > >--- > Koha/BackgroundJobs.pm | 21 --------------------- > misc/workers/es_indexer_daemon.pl | 16 +++++++++++++++- > 2 files changed, 15 insertions(+), 22 deletions(-) > >diff --git a/Koha/BackgroundJobs.pm b/Koha/BackgroundJobs.pm >index f3f6e39e77d..48afbf68fa8 100644 >--- a/Koha/BackgroundJobs.pm >+++ b/Koha/BackgroundJobs.pm >@@ -72,27 +72,6 @@ sub filter_by_current { > ); > } > >-=head3 finish >- >- my $jobs->finish; >- >-Finishes multiple jobs, assumes you have handled success or failure. >- >-=cut >- >-sub finish { >- my ($self) = @_; >- >- while( my $job = $self->next ){ >- $job->update({ >- progress => $job->size(), >- status => 'finished', >- ended_on =>\'NOW()' >- },{ no_triggers => 1}); >- } >- >-} >- > =head2 Internal methods > > =head3 _type >diff --git a/misc/workers/es_indexer_daemon.pl b/misc/workers/es_indexer_daemon.pl >index ebaf322e7eb..89e3b5cb0f0 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 ] })->finish(); >+ # Finish >+ $jobs->update({ >+ progress => 1, >+ status => 'finished', >+ ended_on => \'NOW()', >+ }); > } >-- >2.25.1
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 32594
:
145145
|
145195
|
145196
|
145197
|
145704
|
145711
|
146402
|
146831
|
147141
|
147460
|
147562
|
148350
|
148513
|
148571
|
148588