Skip to content

Instantly share code, notes, and snippets.

@lalitlogical
Created December 18, 2018 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lalitlogical/30a4e8885990442ca776b0ce52285118 to your computer and use it in GitHub Desktop.
Save lalitlogical/30a4e8885990442ca776b0ce52285118 to your computer and use it in GitHub Desktop.
sidekiq
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