downtownott
downtownott

Reputation: 31

Rails 6.1: Jobs on Heroku going to Async instead of Sidekiq

I've been trying to get Sidekiq working on Heroku and can't get my app to use it instead of Async(default). On my local everything works fine and I can see the jobs going into sidekiq, but on production (heroku), the app continues to use the Async adapter.

The second worker dyno is up, sidekiq appears to be properly installed as the web UI loads fine. I've tried 3 different redis add-ons, I'm currently using heroku-redis.

I've included some of my configuration files below, I've tried to follow this medium post.

*/production.rb
config.active_job_queue_adapter = :sidekiq
*Procfile
web: bin/rails server -p ${PORT:-5000} -e $RAILS_ENV
release: bin/rails db:migrate
worker: bundle exec sidekiq -c 2

I've tried different versions of the redis.rb initializer, currently using the one recommended in the heroku docs.

*/intializers/redis.rb
$redis = Redis.new(url: ENV["REDIS_URL"], ssl_params: { verify_mode: OpenSSL::SSL::VERIFY_NONE })
*/initializers/sidekiq.rb
if ENV['REDIS_URL']
    Sidekiq.configure_client do |config|
        config.redis = {url:ENV['REDIS_URL'], size: 1, network_timeout:5}
    end 
    Sidekiq.configure_server do |config|
        config.redis = {url:ENV['REDIS_URL'], size: 12, network_timeout:5}
    end 
end

I'd love any ideas, thanks!

Upvotes: 0

Views: 300

Answers (1)

Lucas Mansur
Lucas Mansur

Reputation: 21

You made a typo in your config/environments/production.rb file. Instead of:

config.active_job_queue_adapter = :sidekiq

try:

config.active_job.queue_adapter = :sidekiq

Notice the dot (.) after active_job instead of an underscore (_).

Upvotes: 2

Related Questions