Bugzilla – Attachment 126215 Details for
Bug 29130
Holds queue is empty while holds queue builder is running
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29130 - Holds queue is empty while holds queue builder is running
Bug-29130---Holds-queue-is-empty-while-holds-queue.patch (text/plain), 3.28 KB, created by
Kyle M Hall
on 2021-10-13 14:57:04 UTC
(
hide
)
Description:
Bug 29130 - Holds queue is empty while holds queue builder is running
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2021-10-13 14:57:04 UTC
Size:
3.28 KB
patch
obsolete
>From 33379073c508a500541426a0713d6db49ab18f73 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 28 Sep 2021 12:35:18 -0400 >Subject: [PATCH] Bug 29130 - Holds queue is empty while holds queue builder is > running > >When build_holds_queue.pl, it first deletes all rows from tmp_holdsqueue and hold_fill_targets, >then starts building the holds queue again. >It seems sensible to build the holds queue using temporary tables and copy the data over afterward. > >Test Plan: >1) Apply this patch >2) Run the holds queue builder >3) Verify holds queue was was populated >4) prove t/db_dependent/HoldsQueue.t >--- > C4/HoldsQueue.pm | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index b4d2b026f2..c353f9ee9b 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -167,8 +167,10 @@ Top level function that turns reserves into tmp_holdsqueue and hold_fill_targets > sub CreateQueue { > my $dbh = C4::Context->dbh; > >- $dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old table for new info >- $dbh->do("DELETE FROM hold_fill_targets"); >+ $dbh->do("DROP TABLE IF EXISTS tmp_holdsqueue_builder"); >+ $dbh->do("DROP TABLE IF EXISTS hold_fill_targets_builder"); >+ $dbh->do("CREATE TABLE tmp_holdsqueue_builder LIKE tmp_holdsqueue"); >+ $dbh->do("CREATE TABLE hold_fill_targets_builder LIKE hold_fill_targets"); > > my $total_bibs = 0; > my $total_requests = 0; >@@ -213,6 +215,16 @@ sub CreateQueue { > #warn Dumper($hold_requests), Dumper($available_items), Dumper($item_map); > } > } >+ >+ my $do_not_lock = ( exists $ENV{_} && $ENV{_} =~ m|prove| ) || $ENV{KOHA_TESTING}; >+ $dbh->{AutoCommit} = 0 unless $do_not_lock; >+ $dbh->do("DELETE FROM tmp_holdsqueue"); # clear the old tables for new info >+ $dbh->do("DELETE FROM hold_fill_targets"); >+ $dbh->do("INSERT INTO tmp_holdsqueue SELECT * FROM tmp_holdsqueue_builder"); >+ $dbh->do("INSERT INTO hold_fill_targets SELECT * FROM hold_fill_targets_builder"); >+ $dbh->do("DROP TABLE tmp_holdsqueue_builder"); >+ $dbh->do("DROP TABLE hold_fill_targets_builder"); >+ $dbh->commit() unless $do_not_lock; > } > > =head2 GetBibsWithPendingHoldRequests >@@ -702,7 +714,7 @@ sub CreatePicklistFromItemMap { > my $dbh = C4::Context->dbh; > > my $sth_load=$dbh->prepare(" >- INSERT INTO tmp_holdsqueue (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber, >+ INSERT INTO tmp_holdsqueue_builder (biblionumber,itemnumber,barcode,surname,firstname,phone,borrowernumber, > cardnumber,reservedate,title, itemcallnumber, > holdingbranch,pickbranch,notes, item_level_request) > VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?) >@@ -747,7 +759,7 @@ sub AddToHoldTargetMap { > my $dbh = C4::Context->dbh; > > my $insert_sql = q( >- INSERT INTO hold_fill_targets (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id) >+ INSERT INTO hold_fill_targets_builder (borrowernumber, biblionumber, itemnumber, source_branchcode, item_level_request, reserve_id) > VALUES (?, ?, ?, ?, ?, ?) > ); > my $sth_insert = $dbh->prepare($insert_sql); >-- >2.30.1 (Apple Git-130)
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 29130
:
125427
|
125430
|
125431
|
125432
| 126215 |
126224
|
126225
|
126227