Bug 18519 - Add ability to skip irrelevant dates in Koha::Calendar
Summary: Add ability to skip irrelevant dates in Koha::Calendar
Status: RESOLVED DUPLICATE of bug 25723
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Martin Renvoize
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 14315
  Show dependency treegraph
 
Reported: 2017-05-01 16:56 UTC by Barton Chittenden
Modified: 2020-06-17 06:59 UTC (History)
8 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 18519: Use a hasref for lookup (3.75 KB, patch)
2020-06-12 15:31 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Barton Chittenden 2017-05-01 16:56:08 UTC
We've seen occurrences of fines.pl and overdue_notices.pl slowing down when there are a large number of (usually old) entries in special_holidays table. Apparently, we're checking each candidate day against the whole fines calendar -- this is unnecessary, as both fines and overdue notices are are bounded; we only need to check the calendar enteries between the current day and the relevant letter delay (for overdue notices) or between the day the item went overdue and the current day (for fines). If we could pass in a start and end date, we could eliminate this overhead.
Comment 1 Martin Renvoize 2020-06-12 13:45:51 UTC
Well.. we could easily switch from an array which we iterate to a hashref we can to a direct lockup on within the single_holidays method.. that would be a good first step I think. The caveat is that we trade some RAM for performances.. but I don't think it was a deliberate act to choose and array over a hashref in the first place.
Comment 2 Martin Renvoize 2020-06-12 15:31:29 UTC
Created attachment 105843 [details] [review]
Bug 18519: Use a hasref for lookup

Rather than using an array of dates and iterating them, use a hashref
and do a direct lookup
Comment 3 Martin Renvoize 2020-06-15 08:12:23 UTC
So, this made a really significant impact on fines and checkout times on one of our live servers.. The customer in question has added the entirety of Covid Lockdown as special holidays to allow for proper fines calculations for items that went overdue just prior to lockdown.
Comment 4 Martin Renvoize 2020-06-17 06:58:59 UTC

*** This bug has been marked as a duplicate of bug 25723 ***