Bugzilla – Attachment 124639 Details for
Bug 28966
Holds queue viewer too slow to load for large numbers of holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28966: Prefetch patron data for holds queue viewer
Bug-28966-Prefetch-patron-data-for-holds-queue-vie.patch (text/plain), 4.37 KB, created by
Kyle M Hall (khall)
on 2021-09-08 11:06:07 UTC
(
hide
)
Description:
Bug 28966: Prefetch patron data for holds queue viewer
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2021-09-08 11:06:07 UTC
Size:
4.37 KB
patch
obsolete
>From ea510d7346dbd151fb0acfffb2f4454c56927421 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 7 Sep 2021 14:07:46 -0400 >Subject: [PATCH] Bug 28966: Prefetch patron data for holds queue viewer > >We have a partner processing thousands of holds per day, per branch. At this number of holds, the script loads very slow if it manages to load at all. The primary slowdown is the individual fetch of the patron for each hold to be displayed. If we prefetch those patrons, the entire script should load much faster. > >Test Plan: >1) Create as many holds as you can ( up to a few thousand if you can ) >2) Run the holds queue viewer, note the load time >3) Apply this patch >4) Restart all the things! >5) Reload the holds queue viewer, load time should be improved >6) Note the HTML generated looks the same >--- > C4/HoldsQueue.pm | 18 +++++++++++++++++- > circ/view_holdsqueue.pl | 3 --- > .../prog/en/modules/circ/view_holdsqueue.tt | 2 +- > 3 files changed, 18 insertions(+), 5 deletions(-) > >diff --git a/C4/HoldsQueue.pm b/C4/HoldsQueue.pm >index 3774214527..1fca6b5cd6 100644 >--- a/C4/HoldsQueue.pm >+++ b/C4/HoldsQueue.pm >@@ -136,7 +136,13 @@ sub GetHoldsQueueItems { > my $dbh = C4::Context->dbh; > > my @bind_params = (); >- my $query = q/SELECT tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location, >+ my $query = q/SELECT borrowers.surname, >+ borrowers.othernames, >+ borrowers.firstname, >+ borrowers.cardnumber, >+ borrowers.borrowernumber, >+ borrowers.title AS borrower_title, >+ tmp_holdsqueue.*, biblio.author, items.ccode, items.itype, biblioitems.itemtype, items.location, > items.enumchron, items.cn_sort, biblioitems.publishercode, > biblio.copyrightdate, biblio.subtitle, biblio.medium, > biblio.part_number, biblio.part_name, >@@ -146,6 +152,7 @@ sub GetHoldsQueueItems { > JOIN biblio USING (biblionumber) > LEFT JOIN biblioitems USING (biblionumber) > LEFT JOIN items USING ( itemnumber) >+ LEFT JOIN borrowers USING (borrowernumber) > /; > if ($branchlimit) { > $query .=" WHERE tmp_holdsqueue.holdingbranch = ?"; >@@ -162,6 +169,15 @@ sub GetHoldsQueueItems { > } > delete $row->{itemtype}; > >+ $row->{borrower} = { >+ borrowernumber => $row->{borrowernumber}, >+ cardnumber => $row->{cardnumber}, >+ firstname => $row->{firstname}, >+ othernames => $row->{othernames}, >+ surname => $row->{surname}, >+ title => $row->{borrower_title}, >+ }; >+ > push @$items, $row; > } > return $items; >diff --git a/circ/view_holdsqueue.pl b/circ/view_holdsqueue.pl >index 4e6384e317..11304c1dc6 100755 >--- a/circ/view_holdsqueue.pl >+++ b/circ/view_holdsqueue.pl >@@ -51,9 +51,6 @@ my $itemtypeslimit = $params->{'itemtypeslimit'}; > if ( $run_report ) { > # XXX GetHoldsQueueItems() does not support $itemtypeslimit! > my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit); >- for my $item ( @$items ) { >- $item->{patron} = Koha::Patrons->find( $item->{borrowernumber} ); >- } > $template->param( > branchlimit => $branchlimit, > total => scalar @$items, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >index 564ab5f54f..486143c021 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt >@@ -184,7 +184,7 @@ > </td> > <td class="hq-patron"> > <p> >- [% INCLUDE 'patron-title.inc' invert_name=1 patron=itemsloo.patron hide_patron_infos_if_needed=1 link_to="circulation_reserves" %] >+ [% INCLUDE 'patron-title.inc' invert_name=1 borrower=itemsloo.borrower hide_patron_infos_if_needed=1 link_to="circulation_reserves" %] > </p> > [% UNLESS Koha.Preference('HidePatronName') %] > <p>[% itemsloo.patron.phone | html %]</p> >-- >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 28966
:
124626
|
124627
|
124628
|
124629
|
124639
|
124652
|
124854
|
125377
|
143583
|
143584
|
143857
|
143859
|
143860
|
145395
|
151733
|
151734
|
153120
|
153875
|
153876
|
153877
|
153878
|
153879
|
153880
|
153881
|
153882
|
153928
|
153929
|
153939