[Koha-bugs] [Bug 14494] New: Terribly slow checkout caused by DateTime->new in far future
bugzilla-daemon at bugs.koha-community.org
bugzilla-daemon at bugs.koha-community.org
Mon Jul 6 13:33:00 CEST 2015
http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14494
Bug ID: 14494
Summary: Terribly slow checkout caused by DateTime->new in far
future
Change sponsored?: ---
Product: Koha
Version: master
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: P5 - low
Component: Architecture, internals, and plumbing
Assignee: gmcharlt at gmail.com
Reporter: m.de.rooy at rijksmuseum.nl
QA Contact: testopia at bugs.koha-community.org
An expiry date of 9999-12-31 for organizations was a nice idea :)
But checking out an item to that patron takes 1 minute or longer !
The cause?
The following lines in CanBookBeIssued seem to be the main cause:
my $expiry_dt = DateTime->new(
year => $y,
month => $m,
day => $d,
time_zone => C4::Context->tz,
);
This call takes forever with 9999-12-31 when the timezone is not 'floating' or
'UTC', but e.g. Europe/Amsterdam.
If the timezone is UTC, it takes 0.0002 seconds.
DateTime gives the following advices:
===
Do not try to use named time zones (like "America/Chicago") with dates very far
in the future (thousands of years). The current implementation of
DateTime::TimeZone will use a huge amount of memory calculating all the DST
changes from now until the future date. Use UTC or the floating time zone and
you will be safe.
•use UTC for all calculations
If you do care about time zones (particularly DST) or leap seconds, try to use
non-UTC time zones for presentation and user input only. Convert to UTC
immediately and convert back to the local time zone for presentation
The results DateTime.pm produces are predictable and correct, and mostly
intuitive, but datetime math gets very ugly when time zones are involved ...
===
We are not doing that currently. We use in C4::Context:
DateTime::TimeZone->new(name => 'local')
Could we implement the calculation/presentation advice of DateTime in Koha
somehow?
--
You are receiving this mail because:
You are watching all bug changes.
More information about the Koha-bugs
mailing list