Created
December 18, 2018 06:12
-
-
Save lalitlogical/30a4e8885990442ca776b0ce52285118 to your computer and use it in GitHub Desktop.
sidekiq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
rails_root = Rails.root || File.dirname(__FILE__) + '/../..' | |
rails_env = Rails.env || 'development' | |
redis_config = YAML.load(ERB.new(File.read("#{Rails.root}/config/redis.yml")).result)[rails_env] | |
redis_config.symbolize_keys! | |
Sidekiq.configure_server do |config| | |
config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" } | |
end | |
Sidekiq.configure_client do |config| | |
config.redis = { url: "redis://#{redis_config[:host]}:#{redis_config[:port]}/12" } | |
end | |
schedule_file = "config/schedule.yml" | |
if File.exists?(schedule_file) | |
Sidekiq::Cron::Job.load_from_hash YAML.load_file(schedule_file) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment