Bugzilla – Attachment 134388 Details for
Bug 30654
Even with RabbitMQ enabled, we should poll the database for jobs at worker startup
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30654: Processing outstanding jobs on startup
Bug-30654-Processing-outstanding-jobs-on-startup.patch (text/plain), 1.74 KB, created by
Martin Renvoize (ashimema)
on 2022-04-29 13:54:24 UTC
(
hide
)
Description:
Bug 30654: Processing outstanding jobs on startup
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-04-29 13:54:24 UTC
Size:
1.74 KB
patch
obsolete
>From 8243a32e5bb8ae73635a760fc78ed62c39faff25 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 29 Apr 2022 14:52:59 +0100 >Subject: [PATCH] Bug 30654: Processing outstanding jobs on startup > >This patch ensures jobs queued up in the database prior to worker >startup are processed regardless as to whether you are using RabbitMQ or >Database polling. >--- > misc/background_jobs_worker.pl | 18 +++++++++++++----- > 1 file changed, 13 insertions(+), 5 deletions(-) > >diff --git a/misc/background_jobs_worker.pl b/misc/background_jobs_worker.pl >index 0027a820e7..a2bd95697f 100755 >--- a/misc/background_jobs_worker.pl >+++ b/misc/background_jobs_worker.pl >@@ -75,6 +75,9 @@ try { > }; > > if ( $conn ) { >+ # process outstanding jobs on startup >+ process_outstanding; >+ > # FIXME cf note in Koha::BackgroundJob about $namespace > my $namespace = C4::Context->config('memcached_namespace'); > for my $queue (@queues) { >@@ -100,11 +103,7 @@ while (1) { > $conn->ack( { frame => $frame } ); # FIXME depending on success? > > } else { >- my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues }); >- while ( my $job = $jobs->next ) { >- my $args = decode_json($job->data); >- process_job( $job, { job_id => $job->id, %$args } ); >- } >+ process_outstanding; > sleep 10; > } > } >@@ -124,3 +123,12 @@ sub process_job { > $job->process( $args ); > exit; > } >+ >+sub process_outstanding { >+ my $jobs = Koha::BackgroundJobs->search({ status => 'new', queue => \@queues }); >+ while ( my $job = $jobs->next ) { >+ my $args = decode_json($job->data); >+ process_job( $job, { job_id => $job->id, %$args } ); >+ } >+ return 1; >+} >-- >2.20.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 30654
: 134388