Koha-clms/C4
Kyle M Hall 84ff856f77 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>
(cherry picked from commit 665c5c62fa)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
2016-11-30 14:10:05 +01:00
..
AuthoritiesMarc Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Barcodes Bug 16635: [QA Follow-up] Eliminate some global package vars 2016-06-16 12:03:37 +02:00
Bookseller Bug 10402 follow-up: choose contacts for claims 2014-08-26 11:45:59 -03:00
ClassSortRoutine Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Creators Bug 14468: Remove warnings when creating Labels 2015-10-27 10:12:32 -03:00
External Bug 16636: [QA Follow-up] Make BakerTaylor plack safe 2016-06-16 12:05:38 +02:00
Form Bug 16259: Replace CGI->param with CGI->multi_param in list context - part 2 2016-05-17 07:44:16 +02:00
Heading Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
ILSDI Bug 16864: Silence warnings in t/db_dependent/ILSDI_Services.t 2016-08-17 15:42:49 +02:00
Installer 3.22.10 debian control fixes for debian package 2016-09-16 12:14:29 +02:00
Labels Bug 14781: Creation of barcode types 2of5 not functional 2015-11-05 10:31:46 -03:00
Linker Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Members Bug 16443: Make C4::Members::Statistics plack safe 2016-06-16 10:31:37 +02: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 14107: Patron cards: Make barcode width and height scaling editable 2015-07-24 14:07:18 -03:00
Reports Bug 14982: Remove C4::Dates from guided report wizard and dictionary 2015-10-26 11:20:11 -03:00
SIP Bug 15006: [QA Follow-up] Only handle login requests in raw_transport 2016-08-17 12:03:43 +02:00
Search Bug 17323: Column search_history.time cannot be null 2016-11-30 14:06:47 +01:00
Serials Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
Utils Bug 17375: Search by dateofbirth - handle invalid dates 2016-11-08 10:17:35 +01:00
Accounts.pm Bug 15397 - Pay selected does not works as expected 2016-08-17 14:10:38 +02:00
Acquisition.pm Bug 16971: Missing dependency for HTML::Entities 2016-08-17 15:37:36 +02:00
Auth.pm Bug 16818: External auth redirect broken under Plack 2016-08-17 15:35:24 +02:00
Auth_cas_servers.yaml.sample Bug 17065 - Rename C4/Auth_cas_servers.yaml.orig 2016-08-17 16:00:36 +02:00
Auth_with_cas.pm Bug 17481: Fix incorrect merge of bug 11048 (logout redirection for CAS authentication) 2016-11-30 13:08:58 +01:00
Auth_with_ldap.pm Bug 15889: LDAP authentication: Only update mapped attributes 2016-04-01 14:18:33 +02:00
Auth_with_shibboleth.pm Bug 16818: External auth redirect broken under Plack 2016-08-17 15:35:24 +02:00
AuthoritiesMarc.pm Bug 15130: useless unitialization warnings when updating authorities 2015-11-06 12:08:51 -03:00
BackgroundJob.pm Bug 13606 Clear job data in session when the job is completed 2015-04-23 13:18:48 -03:00
Barcodes.pm Bug 13813: Remove deprecated module C4::Dates from system 2015-09-18 12:40:55 -03:00
Biblio.pm Bug 16556 - KohaToMarcMapped columns sharing same field with biblio(item)number are removed. 2016-09-16 12:01:31 +02:00
Bookseller.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Boolean.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Branch.pm Bug 15628: Remove get_branchinfos_of vestiges 2016-02-04 22:29:05 +01:00
Breeding.pm Bug 13987: Fix server name in z39.50 authority search results 2015-04-22 14:39:00 -03:00
Budgets.pm Bug 15009: QA follow-up 2016-05-16 14:01:43 +02:00
Calendar.pm Bug 15333: Use Koha::Cache to cache exception_holidays instead of a package variable 2016-06-09 09:32:46 +02:00
Category.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Charset.pm Bug 14078: (followup) converting from ISO5426 is not complete 2015-11-16 12:48:44 -03:00
Circulation.pm Bug 14736 - AllowRenewalIfOtherItemsAvailable slows circulation down in case of a record with many items and many holds 2016-11-30 14:10:05 +01:00
ClassSortRoutine.pm Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
ClassSource.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Context.pm Bug 16813: Allow empty string for OPACBaseURL 2016-08-17 12:45:46 +02:00
Contract.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
CourseReserves.pm Bug 15530 - Editing a course item via a disabled course disables it even if it is on other enabled courses 2016-01-27 15:33:36 +01:00
Creators.pm Bug 14059: Delete all export of get_column_names 2015-05-22 17:02:21 -03:00
Csv.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Debug.pm Bug 14870: (followup) Remove mention of C4::Dates from C4/Debug.pm 2015-11-19 13:05:06 -03:00
HTML5Media.pm Bug 12885: Fix if url contains +*... and HTML5 Media is enabled 2015-09-02 14:38:29 -03:00
Heading.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
HoldsQueue.pm Bug 15062: Holds queue with Transport Cost Matrix will transfer item even if transfers disabled 2015-11-23 11:32:53 -03:00
Images.pm Bug 14778: Install fixtures for t/Images.t 2015-10-23 12:01:18 -03:00
ImportBatch.pm Bug 6852: Staged import reports wrong success for items 2016-09-16 11:09:21 +02:00
ImportExportFramework.pm Bug 17389: Clear logs 2016-10-24 12:02:11 +02:00
InstallAuth.pm Bug 15005: Replace CGI->url with the corresponding url 2015-10-19 09:36:43 -03:00
Installer.pm Bug 13669: Catch the errors to have them to the logs 2016-05-25 10:06:07 +02:00
ItemCirculationAlertPreference.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
ItemType.pm Bug 16356: Fix Error 500 when returning an item which itemtype is not in itemtypes table 2016-04-28 12:51:07 +02:00
Items.pm Bug 14598 [QA Followup] - Correct the behavior of GetItem 2016-11-30 13:48:06 +01:00
Koha.pm Bug 16716: Replaced wrong GROUP BY with DISTINCT 2016-08-17 13:40:41 +02:00
Labels.pm Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Languages.pm Bug 16770: Remove wrong caching of 3 subroutines in C4::Lancuages 2016-08-16 15:33:10 +02:00
Letters.pm Bug 17446: Typo seleted 2016-10-24 12:29:16 +02:00
Linker.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Log.pm Bug 15939: Action logs - Do not default dates to today 2016-03-07 11:35:14 +01:00
MarcModificationTemplates.pm Bug 14098: Implement the copy_and_replace action for MTT 2015-09-07 11:17:13 -03:00
Matcher.pm Bug 15745: C4::Matcher gets CCL parsing error if term contains ? (question mark) 2016-04-06 16:38:52 +02:00
Members.pm Bug 15690: Hardcoded 16 is uncool 2016-11-30 13:26:34 +01: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-25 11:27:22 +02:00
Output.pm Bug 15111: Change X-Frame-Options with SAMEORIGIN 2016-04-22 10:51:11 +02:00
Overdues.pm Bug 14390: [Follow-up] Only update FU record in UpdateFine 2016-09-16 08:06:40 +02:00
Patroncards.pm Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Print.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Ratings.pm Bug 14383: Fix POD error in C4/Ratings.pm 2015-06-22 17:34:47 -03:00
Record.pm Bug 12357: Following whitespace failures on koha qa test tools. 2015-09-07 13:59:07 -03:00
Reports.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Reserves.pm Bug 14968 - found shouldn't be set to null when cancelling holds 2016-08-16 16:09:54 +02:00
Review.pm Bug 13969: Replace calls to $sth->fetchrow* with a call to $dbh->selectrow* and Cleaning files 2015-05-14 11:11:41 -03:00
Ris.pm Bug 16245: [QA Follow-up] Replace typeofrecord2 by biblevel 2016-10-24 12:48:33 +02:00
RotatingCollections.pm Bug 15066: Make transfer rotating collection works under Plack 2015-11-05 09:50:09 -03:00
SMS.pm Bug 14421: Corrected example in SMS.pm to working version with hashref. 2015-06-22 11:08:29 -03:00
Scheduler.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Scrubber.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Search.pm Bug 17107 - Add ident and Identifier-standard to known indexes 2016-08-24 12:45:13 +02:00
Serials.pm Bug 12178: Update serial status to "claimed" when exporting to CSV 2016-08-17 11:33:26 +02:00
Service.pm Bug 11559: Supporting changes for Rancor 2015-10-27 12:16:05 -03:00
ShelfBrowser.pm Bug 16315 - OPAC Shelfbrowser doesn't display the full title 2016-05-16 10:08:03 +02: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 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
Suggestions.pm Bug 16325: Do not return all suggestions if search for STATUS='' 2016-05-16 13:24:14 +02:00
TTParser.pm Bug 14383: C4: Fix some typos (mostly in comments and documentation) 2015-06-22 17:34:45 -03:00
Tags.pm Bug 16637: Dependency for C4::Tags not listed 2016-06-16 12:07:29 +02:00
Templates.pm Bug 16088: Introduce Koha::Cache::Memory::Lite to cache the language 2016-06-16 13:46:28 +02:00
TmplToken.pm Bug 6679: (follow-up) fix 9 perlcritic violations in C4/TmplTokenType.pm 2016-01-27 15:26:02 +01:00
TmplTokenType.pm Bug 6679: (follow-up) fix 9 perlcritic violations in C4/TmplTokenType.pm 2016-01-27 15:26:02 +01:00
UsageStats.pm Bug 14097: Testing C4::UsageStats 2016-03-07 14:22:01 +01:00
XISBN.pm Bug 9978: Replace license header with the correct license (GPLv3+) 2015-04-20 09:59:38 -03:00
XSLT.pm Bug 7441 - search results showing wrong branch? 2016-08-23 16:13:23 +02:00