Bugzilla – Attachment 161684 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: nack and not requeue if frame is invalid
Bug-35819-nack-and-not-requeue-if-frame-is-invalid.patch (text/plain), 2.43 KB, created by
Tomás Cohen Arazi (tcohen)
on 2024-01-31 13:41:39 UTC
(
hide
)
Description:
Bug 35819: nack and not requeue if frame is invalid
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2024-01-31 13:41:39 UTC
Size:
2.43 KB
patch
obsolete
>From df35b3e6c2da2478468a25e4d899420dd76763ab Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 23 Jan 2024 10:14:21 +0100 >Subject: [PATCH] Bug 35819: nack and not requeue if frame is invalid > >If a frame cannot be correctly processed (most probably because the body >is not valid JSON) then we are not acking or nacking the frame and the >worker is stuck. > >In this specific case we should nack without requeuing the frame. > >NOTE that requeue must be 'true' or 'false', not 1 or 0, or the default >'true' will be used. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > misc/workers/background_jobs_worker.pl | 30 +++++++++++++------------- > 1 file changed, 15 insertions(+), 15 deletions(-) > >diff --git a/misc/workers/background_jobs_worker.pl b/misc/workers/background_jobs_worker.pl >index 3b90827c559..85176e584d2 100755 >--- a/misc/workers/background_jobs_worker.pl >+++ b/misc/workers/background_jobs_worker.pl >@@ -124,23 +124,23 @@ while (1) { > return; > }; > >- my $job; >- >- if ($args) { >- $job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; >- unless ($job) { >- Koha::Logger->get( { interface => 'worker' } ) >- ->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); >- >- # nack to force requeue >- $conn->nack( { frame => $frame, requeue => 1 } ); >- Time::HiRes::sleep(0.5); >- next; >- } >- $conn->ack( { frame => $frame } ); >- } else { >+ unless ( $args ) { >+ Koha::Logger->get({ interface => 'worker' })->warn(sprintf "Frame does not have correct args, ignoring it"); >+ $conn->nack( { frame => $frame, requeue => 'false' } ); >+ next; >+ } >+ >+ my $job = Koha::BackgroundJobs->search( { id => $args->{job_id}, status => 'new' } )->next; >+ unless ($job) { >+ Koha::Logger->get( { interface => 'worker' } ) >+ ->warn( sprintf "Job %s not found, or has wrong status", $args->{job_id} ); >+ >+ # nack to force requeue >+ $conn->nack( { frame => $frame, requeue => 'true' } ); >+ Time::HiRes::sleep(0.5); > next; > } >+ $conn->ack( { frame => $frame } ); > > $pm->start and next; > srand(); # ensure each child process begins with a new seed >-- >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