Skip to content
This repository has been archived by the owner on Jul 24, 2020. It is now read-only.

Commit

Permalink
updated schedule.rb to resolve simultaneous cron firing
Browse files Browse the repository at this point in the history
  • Loading branch information
orenyk committed Oct 8, 2014
1 parent 8c0b5a6 commit 4a0268f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions config/schedule.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,24 @@

# Learn more: http://github.com/javan/whenever

every 1.day, :at => '5:00 am' do
# stagger jobs by offsetting with current time
time = Time.new

# define cron strings
nightly_cron_str = time.min.to_s + " 5 * * *"
hourly_cron_str = time.min.to_s + " * * * *"

# every night around 5 AM
every nightly_cron_str do
rake "send_upcoming_checkin_reminder"
rake "send_overdue_checkin_reminder"
rake "delete_missed_reservations"
rake "deny_missed_requests"
rake "delete_old_blackouts"
end

every 1.hour do
# every hour (except five AM)
every hourly_cron_str do
rake "send_reservation_notes"
end

0 comments on commit 4a0268f

Please sign in to comment.