Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Catches the TZInfo::PeriodNotFound exception and retries the cron for…

… one hour in the future and also changes the periodic cleanup to 11:59PM
  • Loading branch information...
commit 6a466c64f258b32e3c5857b16c515a2ec3116cbd 1 parent 9fa907b
@snicker authored
Showing with 24 additions and 10 deletions.
  1. +24 −10 bin/schedule.rb
View
34 bin/schedule.rb
@@ -58,7 +58,7 @@ def run!
# Schedule event cleanup.
- rufus_scheduler.cron "0 0 * * * America/Los_Angeles" do
+ rufus_scheduler.cron "59 23 * * * America/Los_Angeles" do
cleanup_expired_events!
end
@@ -74,15 +74,29 @@ def run!
# Times are assumed to be in PST for now. Can store a user#timezone later.
24.times do |hour|
- rufus_scheduler.cron "0 #{hour} * * * America/Los_Angeles" do
- if hour == 0
- run_schedule "midnight"
- elsif hour < 12
- run_schedule "#{hour}am"
- elsif hour == 12
- run_schedule "noon"
- else
- run_schedule "#{hour - 12}pm"
+ begin
+ rufus_scheduler.cron "0 #{hour} * * * America/Los_Angeles" do
+ if hour == 0
+ run_schedule "midnight"
+ elsif hour < 12
+ run_schedule "#{hour}am"
+ elsif hour == 12
+ run_schedule "noon"
+ else
+ run_schedule "#{hour - 12}pm"
+ end
+ end
+ rescue ::TZInfo::PeriodNotFound
+ rufus_scheduler.cron "0 #{hour+1} * * * America/Los_Angeles" do
+ if hour == 0
+ run_schedule "midnight"
+ elsif hour < 12
+ run_schedule "#{hour}am"
+ elsif hour == 12
+ run_schedule "noon"
+ else
+ run_schedule "#{hour - 12}pm"
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.