2013-02-05 14:16:51 -05:00
|
|
|
require 'clockwork'
|
2013-07-08 21:01:51 -04:00
|
|
|
unless ENV['EMBED_CLOCKWORK']
|
|
|
|
require_relative 'boot'
|
|
|
|
require_relative 'environment'
|
|
|
|
end
|
2013-02-05 14:16:51 -05:00
|
|
|
|
2013-02-25 11:42:20 -05:00
|
|
|
# These are jobs you should run on a regular basis to make your
|
2013-02-05 14:16:51 -05:00
|
|
|
# forum work properly.
|
|
|
|
|
2013-06-15 01:25:41 -04:00
|
|
|
def setup_log
|
|
|
|
Clockwork.configure do |config|
|
2013-06-18 03:04:01 -04:00
|
|
|
config[:logger].close
|
2013-06-15 01:25:41 -04:00
|
|
|
config[:logger] = Logger.new(ENV["CLOCK_LOG"])
|
|
|
|
end if ENV["CLOCK_LOG"]
|
|
|
|
end
|
|
|
|
|
|
|
|
trap('HUP') { setup_log }
|
|
|
|
setup_log
|
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
module Clockwork
|
|
|
|
handler do |job|
|
|
|
|
Jobs.enqueue(job, all_sites: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
every(1.day, 'enqueue_digest_emails', at: '06:00')
|
|
|
|
every(1.day, 'category_stats', at: '04:00')
|
2013-04-05 00:29:46 -04:00
|
|
|
every(1.day, 'ensure_db_consistency', at: '02:00')
|
2013-03-28 13:02:59 -04:00
|
|
|
every(10.minutes, 'periodical_updates')
|
2013-02-19 15:16:50 -05:00
|
|
|
every(1.day, 'version_check')
|
2013-03-21 16:51:19 -04:00
|
|
|
every(1.minute, 'clockwork_heartbeat')
|
2013-06-18 10:05:15 -04:00
|
|
|
every(1.minute, 'poll_mailbox')
|
2013-06-17 17:15:11 -04:00
|
|
|
|
2013-02-05 14:16:51 -05:00
|
|
|
end
|