orbit-4-2/config/initializers/resque.rb

21 lines
840 B
Ruby
Raw Permalink Normal View History

require 'resque_scheduler'
require 'resque_scheduler/server'
# require 'yaml'
Resque.redis = 'localhost:6379'
Resque.redis.namespace = Site.first.resque_namespace rescue APP_CONFIG['orbit']
# If you want to be able to dynamically change the schedule,
# uncomment this line. A dynamic schedule can be updated via the
# Resque::Scheduler.set_schedule (and remove_schedule) methods.
# When dynamic is set to true, the scheduler process looks for
# schedule changes and applies them on the fly.
# Note: This feature is only available in >=2.0.0.
#Resque::Scheduler.dynamic = true
Dir["#{Rails.root}/app/jobs/*.rb"].each { |file| require file }
# The schedule doesn't need to be stored in a YAML, it just needs to
# be a hash. YAML is usually the easiest.
Resque.schedule = YAML.load_file(Rails.root.join('config', 'resque_schedule.yml'))