Bugzilla – Attachment 161685 Details for
Bug 35819
"No job found" error for BatchUpdateBiblioHoldsQueue (race condition)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 35819: Improve logging
Bug-35819-Improve-logging.patch (text/plain), 2.49 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-01-31 13:41:42 UTC
(
hide
)
Description:
Bug 35819: Improve logging
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-01-31 13:41:42 UTC
Size:
2.49 KB
patch
obsolete
>From d8deeb3c03d2ff182523b6c78beaf875731f63cd Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 26 Jan 2024 14:25:56 +0100 >Subject: [PATCH] Bug 35819: Improve logging > >Log (warn) if the job will be processed later, but add a debug however. > >Have a specific log for bad status > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > misc/workers/background_jobs_worker.pl | 26 ++++++++++++++++++++++++-- > 1 file changed, 24 insertions(+), 2 deletions(-) > >diff --git a/misc/workers/background_jobs_worker.pl b/misc/workers/background_jobs_worker.pl >index 85176e584d2..94c458268c3 100755 >--- a/misc/workers/background_jobs_worker.pl >+++ b/misc/workers/background_jobs_worker.pl >@@ -73,6 +73,9 @@ my $max_processes = $ENV{MAX_PROCESSES}; > $max_processes ||= C4::Context->config('background_jobs_worker')->{max_processes} if C4::Context->config('background_jobs_worker'); > $max_processes ||= 1; > >+my $not_found_retries = {}; >+my $max_retries = $ENV{MAX_RETRIES} || 10; >+ > GetOptions( > 'm|max-processes=i' => \$max_processes, > 'h|help' => \$help, >@@ -130,10 +133,29 @@ while (1) { > next; > } > >- my $job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; >+ 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 ); >+ >+ # nack without requeue, we do not want to process this frame again >+ $conn->nack( { frame => $frame, requeue => 'false' } ); >+ next; >+ } >+ > unless ($job) { >+ if ( ++$not_found_retries->{$args->{job_id}} >= $max_retries ) { >+ Koha::Logger->get( { interface => 'worker' } ) >+ ->warn( sprintf "Job %s not found, no more retry", $args->{job_id} ); >+ >+ # nack without requeue, we do not want to process this frame again >+ $conn->nack( { frame => $frame, requeue => 'false' } ); >+ next; >+ } >+ > Koha::Logger->get( { interface => 'worker' } ) >- ->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); >+ ->debug( sprintf "Job %s not found, will retry later", $args->{job_id} ); > > # nack to force requeue > $conn->nack( { frame => $frame, requeue => 'true' } ); >-- >2.43.0
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 35819
:
161067
|
161071
|
161139
|
161172
|
161173
|
161267
|
161527
|
161624
|
161682
|
161683
|
161684
|
161685
|
161686
|
161752
|
161753
|
161754
|
161755
|
161756
|
161757