aboutsummaryrefslogtreecommitdiffstats
path: root/perllib/FixMyStreet/SendReport.pm
diff options
context:
space:
mode:
authorMatthew Somerville <matthew@mysociety.org>2015-02-10 17:10:40 +0000
committerMatthew Somerville <matthew-github@dracos.co.uk>2015-02-13 10:09:33 +0000
commit3571f96251df08dd8a9dda3ec4e1fadf30d6c63d (patch)
tree6cd0d05d06a51dfdcbe183c4c10b38c0a15c6231 /perllib/FixMyStreet/SendReport.pm
parent9591ba909210b2a628237074b54e5eb3c6536856 (diff)
Create timezone objects only once at startup.
Cache a DateTime::TimeZone::Local object, so that in an environment where /etc/localtime is a copy of a timezone file, we don't repeatedly walk all the timezone files to find the matching one.
Diffstat (limited to 'perllib/FixMyStreet/SendReport.pm')
-rw-r--r--perllib/FixMyStreet/SendReport.pm3
1 files changed, 1 insertions, 2 deletions
diff --git a/perllib/FixMyStreet/SendReport.pm b/perllib/FixMyStreet/SendReport.pm
index 40e76ef72..9967b0663 100644
--- a/perllib/FixMyStreet/SendReport.pm
+++ b/perllib/FixMyStreet/SendReport.pm
@@ -23,8 +23,7 @@ sub should_skip {
return 0 unless $row->send_fail_count;
- my $tz = DateTime::TimeZone->new( name => 'local' );
- my $now = DateTime->now( time_zone => $tz );
+ my $now = DateTime->now( time_zone => FixMyStreet->local_time_zone );
my $diff = $now - $row->send_fail_timestamp;
my $backoff = $row->send_fail_count > 1 ? 30 : 5;