aboutsummaryrefslogtreecommitdiff
path: root/lib/mauve/server.rb
diff options
context:
space:
mode:
authorAlex Young <alex@bytemark.co.uk>2015-04-20 16:14:03 +0100
committerAlex Young <alex@bytemark.co.uk>2015-04-20 16:14:03 +0100
commit3e986ecfc544b94f329e35ae5b771f68ed27851a (patch)
treef2e32b811ae765c2481c9c64cbdfc91b91033016 /lib/mauve/server.rb
parent0a42bb136dc6ccbbf36500d4cc50441681178867 (diff)
Pull the bank holidays cache out to its own class
Diffstat (limited to 'lib/mauve/server.rb')
-rw-r--r--lib/mauve/server.rb16
1 files changed, 3 insertions, 13 deletions
diff --git a/lib/mauve/server.rb b/lib/mauve/server.rb
index 90d5e77..7ce5823 100644
--- a/lib/mauve/server.rb
+++ b/lib/mauve/server.rb
@@ -13,6 +13,7 @@ require 'mauve/processor'
require 'mauve/http_server'
require 'mauve/heartbeat'
require 'mauve/configuration'
+require 'mauve/bank_holidays_cache'
require 'log4r'
module Mauve
@@ -52,7 +53,7 @@ module Mauve
# Bank Holidays -- this list is kept here, because I can't think of
# anywhere else to put it.
#
- @bank_holidays = nil
+ @bank_holidays_cache = BankHolidaysCache.new
#
# Turn off unwanted reverse DNS lookups across the board.
@@ -127,18 +128,7 @@ module Mauve
#
#
def bank_holidays
- #
- # Update the bank holidays list hourly.
- #
- if @bank_holidays.nil? or
- @bank_holidays_last_checked_at.nil? or
- @bank_holidays_last_checked_at < (Time.now - 1.hour)
-
- @bank_holidays = CalendarInterface.get_bank_holiday_list(Time.now)
- @bank_holidays_last_checked_at = Time.now
- end
-
- @bank_holidays
+ @bank_holidays_cache.bank_holidays
end
# return [Log4r::Logger]