[Koha-bugs] [Bug 14494] Terribly slow checkout caused by DateTime->new in far future

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jul 10 17:33:11 CEST 2015


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14494

--- Comment #24 from Kyle M Hall <kyle at bywatersolutions.com> ---
Created attachment 40932
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=40932&action=edit
[PASSED QA] Bug 14494: Prevent slow checkout if the patron does not have an
expiry date

If a patron has a expiry date set to 9999-12-31 (for organizations for
instance), the checkouts are very slow.

It's caused by 2 different calls to DateTime in CanBookBeIssued:
1/
  DateTime->new( year => 9999, month => 12, day => 31, time_zone =>
C4::Context->tz );
The time_zone should not be set (as it's done in Koha::DateUtils), set to UTC
or floating tz.

2/
  DateTime->compare($today, $expiry_dt)
The comparaison of 2 DT with 1 related to 9999 is very slow, as you can
imagine.

For 1/ we need to call Koha::DateUtils::dt_from_string (actually, we
should never call DateTime directly).
For 2/ we just need to test if the date is != 9999, no need to compare
it in this case.

Test plan:
Before this patch, confirm that the checkouts are slow if the patron has a
dateexpiry set to 9999-12-31.
update borrowers set dateexpiry="9999-12-31" where borrowernumber=42;

After this patch, you should not see any regression when checking out
items to an expired patron and to a valid patron.

Signed-off-by: Marcel de Rooy <m.de.rooy at rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart at bugs.koha-community.org>

Signed-off-by: Kyle M Hall <kyle at bywatersolutions.com>

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list