headwayio / voyage

A Rails template with our standard defaults, ready to deploy to Heroku. **See readme in: lib/voyage/README.md**
https://headway.io/voyage
MIT License
0 stars 1 forks source link

Switch to Sidekiq for Job Processing #22

Closed noahsettersten closed 6 years ago

noahsettersten commented 7 years ago

Gemfile: Replace delayed_job and delayed_job_active_record with sidekiq Procfile: Setup a worker dyno to run bundle exec sidekiq config/environments/development.rb: Add config.active_job.queue_adapter = :sidekiq config/environments/production.rb: Add config.active_job.queue_adapter = :sidekiq

Add config/sidekiq.yml with:

:queues:
  - default

Add config/initializers/sidekiq.rb with:

redis_namespace = '#{VOYAGE_APP_NAME}'
sidekiq_config = if ENV['REDIS_URL']
                   { url: ENV['REDIS_URL'], namespace: redis_namespace }
                 else
                   { namespace: redis_namespace }
                 end

Sidekiq.configure_server do |config|
  config.redis = sidekiq_config
end

Sidekiq.configure_client do |config|
  config.redis = sidekiq_config
end