Koha/C4
Kyle M Hall 665c5c62fa Bug 14736 - AllowRenewalIfOtherItemsAvailable slows circulation down in case of a record with many items and many holds
If the AllowRenewalIfOtherItemsAvailable sys pref is set to allow, and a
borrower has an item checked out that has many items {30+} AND many
holds {70+) on it, loading the checkouts table for this borrower takes
FOREVER to load. The load time takes forever, because of the
factoring that happens to determine if an item is truly
available for renewal.

This patch swaps the use of GetMemberDetails for GetMember
and reorders the subroutine calls to check each items' renewability
from fastest to slowest.

In a test case, the results of pre patch were:
Start of loop: 2016-08-24T11:05:14
End of loop:   2016-08-24T11:05:29
Resulting in 15 seconds being spent in the loop

Post patch results were:
Start of loop: 2016-08-24T11:08:43
End of loop:   2016-08-24T11:08:48
Resulting in only 5 seconds being spent in the loop!

Test Plan:
1) Apply this patch
2) Note there are no changes in functionality for the renewals column of
   the patron checkouts table.

If you wish to go further and test the performance benefit:
1) Create a record with 50 items and 100 holds ( 50 waiting, 50 unfilled )
2) Check out one of the waiting holds to a patron
3) Time the amount of time it takes for the checkouts table to load
4) Apply this patch
5) Repeat step 3, you should see an improvement in load time

Signed-off-by: Jesse Maseto <jesse@bywatersolutions.com>

Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
2016-11-18 13:57:01 +00:00
..
AuthoritiesMarc Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Barcodes Bug 14752 - (QA followup) Remove annoying modal, use dialog box instead 2016-09-13 17:21:05 +00:00
Bookseller Bug 5260 - Add option to send an order by e-mail to the acquisition module 2016-10-28 11:52:25 +00:00
ClassSortRoutine Bug 16011: $VERSION - Remove use vars qw(); 2016-03-24 17:20:39 +00:00
Creators Bug 17301 - Add callnumber to label-edit-batch.pl 2016-09-25 15:49:10 +00:00
External Bug 17189: Replace occurrences of 'use Koha::Cache' 2016-09-08 10:24:47 +00:00
Form Bug 16259: Replace CGI->param with CGI->multi_param in list context - part 2 2016-05-16 17:28:06 +00:00
Heading Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
ILSDI Bug 10455: (follow-up 2) Remove biblioitems.marc 2016-10-21 14:35:00 +00:00
Installer Bug 14629 - Add aggressive ISSN matching feature equivalent to the aggressive ISBN matcher 2016-10-28 11:58:14 +00:00
Labels Bug 15758: Koha::Libraries - Remove GetBranchName 2016-09-08 14:36:01 +00:00
Linker Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Members Bug 10227 : Fix GetMessagingPreferences when digest is possible 2016-09-13 17:14:28 +00:00
OAI Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Output Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Patroncards Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
Reports Bug 17535: Fix search for reports by keywords 2016-11-07 16:38:25 +00:00
Search Bug 17323: Column search_history.time cannot be null 2016-11-18 13:51:37 +00:00
Serials Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
SIP Bug 15901 - Remove use of recordpayment in C4::SIP::ILS::Transaction::FeePayment 2016-09-27 13:52:34 +00:00
Utils Bug 14874: Set default DefaultPatronSearchFields 2016-10-27 13:21:13 +00:00
Accounts.pm Bug 15899 - Remove C4::Accounts::recordpayment 2016-09-27 13:55:12 +00:00
Acquisition.pm Bug 17563: (followup) Silence undef warnings 2016-11-10 13:36:48 +00:00
Auth.pm Bug 16276: [QA Follow-up] Only track when pref is enabled 2016-09-13 17:27:43 +00:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-08 13:16:36 +00:00
Auth_with_cas.pm Bug 17481: Fix incorrect merge of bug 11048 (logout redirection for CAS authentication) 2016-11-07 16:34:57 +00:00
Auth_with_ldap.pm Bug 16853: Move changepassword to Koha::Patron->update_password 2016-07-15 18:09:17 +00:00
Auth_with_shibboleth.pm Bug 16818: External auth redirect broken under Plack 2016-08-04 19:42:44 +00:00
AuthoritiesMarc.pm Bug 16431: Use Koha::Cache to cache marc subfield structure 2016-07-08 12:44:58 +00:00
BackgroundJob.pm Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
Barcodes.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Biblio.pm Bug 10455: (follow-up) Remove biblioitems.marc 2016-10-21 14:34:59 +00:00
Bookseller.pm Bug 13321: Rename variables 2016-10-28 13:45:59 +00:00
Boolean.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Breeding.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Budgets.pm Bug 16123 - Display budget hierarchy in the budget dropdown menu used when placing a new order 2016-10-28 15:26:00 +00:00
Calendar.pm Bug 17189: Replace occurrences of 'use Koha::Cache' 2016-09-08 10:24:47 +00:00
Charset.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Circulation.pm Bug 14736 - AllowRenewalIfOtherItemsAvailable slows circulation down in case of a record with many items and many holds 2016-11-18 13:57:01 +00:00
ClassSortRoutine.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
ClassSource.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Context.pm Bug 16520 - (Follow up) Restore retrieval of syspref_cache 2016-11-15 14:09:33 +00:00
Contract.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
CourseReserves.pm Bug 16011: $VERSION - remove use vars $VERSION 2016-03-24 17:20:26 +00:00
Creators.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Debug.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Heading.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
HoldsQueue.pm Bug 14514 - LocalHoldsPriority and the HoldsQueue conflict with each other 2016-10-11 15:44:47 +00:00
HTML5Media.pm Bug 17231 - (QA Followup) 2016-09-08 12:06:47 +00:00
Images.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
ImportBatch.pm Bug 6852: Staged import reports wrong success for items 2016-09-12 08:55:41 +00:00
ImportExportFramework.pm Bug 17389: Clear logs 2016-10-11 16:18:10 +00:00
InstallAuth.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Installer.pm Bug 17216: Move the AV cat list file to the top level 2016-10-11 07:30:33 +00:00
ItemCirculationAlertPreference.pm Bug 15407: Koha::Patron::Categories - replace C4::Category->all 2016-09-08 13:29:03 +00:00
Items.pm Bug 14598 [QA Followup] - Correct the behavior of GetItem 2016-10-28 11:29:58 +00:00
Koha.pm Bug 15803: Koha::AuthorisedValues - Remove C4::Koha::GetAuthorisedValueCategories 2016-10-28 16:35:52 +00:00
Labels.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Languages.pm Bug 16770: Remove wrong caching of 3 subroutines in C4::Lancuages 2016-06-24 14:05:56 +00:00
Letters.pm Bug 5260: QA follow-up: Fix error when no notice template is defined 2016-10-28 11:52:26 +00:00
Linker.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Log.pm Bug 14642: Add logging for Holds 2016-08-17 18:43:13 +00:00
MarcModificationTemplates.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Matcher.pm Bug 14629 - Add aggressive ISSN matching feature equivalent to the aggressive ISBN matcher 2016-10-28 11:58:14 +00:00
Members.pm Bug 15690: Hardcoded 16 is uncool 2016-11-14 11:28:43 +00:00
Message.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
NewsChannels.pm Bug 16550: Can't set opac news expiration date to NULL, it reverts to today 2016-05-23 17:37:48 +00:00
Output.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Overdues.pm Bug 17599: Move C4::Circulation::GetIssuingRule to Koha::IssuingRules->get_effective_issuing_rule 2016-11-15 15:41:43 +00:00
Patroncards.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Print.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Record.pm Bug 17249: Remove GetKohaAuthorisedValuesFromField - Add search_by_marc_field 2016-10-21 15:13:56 +00:00
Reports.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Reserves.pm Bug 17599: Move C4::Circulation::GetIssuingRule to Koha::IssuingRules->get_effective_issuing_rule 2016-11-15 15:41:43 +00:00
Ris.pm Bug 16245: [QA Follow-up] Replace typeofrecord2 by biblevel 2016-10-21 14:51:55 +00:00
RotatingCollections.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Scheduler.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Scrubber.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
Search.pm Bug 17253: Koha::AuthorisedValues - Remove GetKohaAuthorisedValues 2016-10-21 15:35:34 +00:00
Serials.pm Bug 9896 - Show vendor in subscription search when creating an order for a subscription 2016-09-25 14:09:56 +00:00
Service.pm Bug 11559: Supporting changes for Rancor 2015-10-27 12:16:05 -03:00
ShelfBrowser.pm Bug 15758: Koha::Libraries - Remove GetBranches 2016-09-08 14:36:03 +00:00
SMS.pm Bug 16011: $VERSION - Remove empty BEGIN block 2016-03-24 17:20:41 +00:00
SocialData.pm Bug 9978: (followup) Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:43 -03:00
Stats.pm Bug 16011: $VERSION - Remove comments 2016-03-24 17:20:29 +00:00
Suggestions.pm Bug 16325: Do not return all suggestions if search for STATUS='' 2016-05-05 20:46:02 +00:00
Tags.pm Bug 16637: Dependency for C4::Tags not listed 2016-06-10 18:05:10 +00:00
Templates.pm Bug 16088: Introduce Koha::Cache::Memory::Lite to cache the language 2016-06-04 07:43:22 +00:00
TmplToken.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
TmplTokenType.pm Bug 16011: $VERSION - Remove the $VERSION init 2016-03-24 17:20:28 +00:00
TTParser.pm Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
UsageStats.pm Bug 15131: Add AllowItemsOnHoldCheckoutSCO to UsageStats 2016-10-21 17:27:07 +00:00
XISBN.pm Bug 12478: make things using SimpleSearch use the new version 2016-04-26 20:20:07 +00:00
XSLT.pm Bug 17435: Gives ability to display stocknumber in search results 2016-10-28 11:49:18 +00:00