Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Catches the TZInfo::PeriodNotFound exception and retries the cron for on... #181

Closed
wants to merge 1 commit into from

3 participants

@snicker

...e hour in the future and also changes the periodic cleanup to 11:59PM

This needs some refactoring, but a ruby wizard I am not. maybe move that block into it's own method?

@snicker snicker Catches the TZInfo::PeriodNotFound exception and retries the cron for…
… one hour in the future and also changes the periodic cleanup to 11:59PM
6a466c6
@snicker

fix for #180

@cantino
Owner

Interesting, so shifting it an hour fixes it for you?

@snicker
@cantino
Owner
@snicker
@cantino
Owner
@snicker
@cantino
Owner

At least on my system, everything is working okay now. We should still fix this for next year, but there's no rush. I'll look at this shortly :)

@alias1
Collaborator

Ping @cantino

@cantino
Owner
@cantino cantino closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 8, 2014
  1. @snicker

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

    snicker authored
    … one hour in the future and also changes the periodic cleanup to 11:59PM
This page is out of date. Refresh to see the latest.
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
Something went wrong with that request. Please try again.