Bugzilla – Attachment 189581 Details for
Bug 41248
Add ability for real time holds queue background jobs to skip duplicate jobs
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41248: Add ability for real time holds queue background jobs to skip duplicate jobs
Bug-41248-Add-ability-for-real-time-holds-queue-ba.patch (text/plain), 1.77 KB, created by
Lucas Gass (lukeg)
on 2025-11-13 18:41:43 UTC
(
hide
)
Description:
Bug 41248: Add ability for real time holds queue background jobs to skip duplicate jobs
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2025-11-13 18:41:43 UTC
Size:
1.77 KB
patch
obsolete
>From 7074d224f36f2db21fb4b712f95733b1ae72d93b Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Thu, 13 Nov 2025 09:40:00 -0500 >Subject: [PATCH] Bug 41248: Add ability for real time holds queue background > jobs to skip duplicate jobs > >It seems inefficient to rebuild the holds queue repeatedly for the same record. We should skip enqueuing BatchUpdateBiblioHoldsQueue jobs if there is already a queued job that hasn't started. > >Test Plan: >1) Enable real time holds queue >2) Ensure the default queue background job worker is not running >3) Set up 2 or more holds for the record >4) Alter the priority for those holds a couple times >5) Confirm only one new job is in the background_jobs table for that > record. > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm | 8 ++++++++ > 1 file changed, 8 insertions(+) > >diff --git a/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm b/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm >index 53b5d2b45c4..9d3842e0c82 100644 >--- a/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm >+++ b/Koha/BackgroundJob/BatchUpdateBiblioHoldsQueue.pm >@@ -19,6 +19,7 @@ use Modern::Perl; > > use Try::Tiny; > >+use Koha::BackgroundJobs; > use Koha::Biblios; > use Koha::Exceptions; > >@@ -134,6 +135,13 @@ sub enqueue { > > my @biblio_ids = @{ $args->{biblio_ids} }; > >+ # If any given bib has a specific job already queued, we can skip this job. Limited to single bib jobs for performance. >+ @biblio_ids = grep { >+ Koha::BackgroundJobs->count( { type => $self->job_type, status => 'new', data => qq/{"biblio_ids":["$_"]}/ } ) >+ == 0 >+ } @biblio_ids; >+ return unless @biblio_ids; >+ > $self->SUPER::enqueue( > { > job_size => scalar @biblio_ids, >-- >2.39.5
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 41248
:
189567
|
189569
|
189570
|
189571
| 189581 |
189582