educoder/config/initializers/sidekiq.rb

18 lines
471 B

require 'sidekiq/web'
require 'sidekiq/cron/web'
redis_config = Rails.application.config_for(:redis)
sidekiq_url = redis_config["url"]
Sidekiq.configure_server do |config|
config.redis = { url: sidekiq_url }
end
Sidekiq.configure_client do |config|
config.redis = { url: sidekiq_url }
end
schedule_file = "config/schedule.yml"
if File.exists?(schedule_file) && Sidekiq.server?
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file)
end