Sidekiq jobs stuck in line at Heroku

I have a Sidekiq worker who works well locally, but when deployed to Heroku, jobs get stuck in the queue. I use Redis-to-go nano and run it, and I increased the working to 1 on Heroku and see that it works. I just use the default queue - nothing unusual or unusual. Here is my code:

config / unicorn.rb:

Sidekiq.configure_client do |config| config.redis = { size: 1, namespace: 'sidekiq' } end 

configurations / Initializers / redis.rb

 uri = URI.parse(ENV["REDISTOGO_URL"] || "redis://localhost:6379") REDIS = Redis.new(:url => ENV['REDISTOGO_URL']) 

PROCFILE

 web: bundle exec unicorn -p $PORT -c ./config/unicorn.rb worker: bundle exec sidekiq -c 5 -v -q default 

I can see the job in the queue, but it is not processed as locally. Any advice is greatly appreciated - thanks!

+6
source share
3 answers

Not sure what the problem is, but after this tutorial with some changes designed for me: http://manuelvanrijn.nl/blog/2012/11/13/sidekiq-on-heroku-with-redistogo-nano/

In short, I moved the configuration to the sidekiq.rb initializer and deleted all the URL and namespace information.

 require 'sidekiq' Sidekiq.configure_client do |config| config.redis = { :size => 1 } end Sidekiq.configure_server do |config| config.redis = { :size => 4 } end 

The tutorial link I am referring to has a handy calculator to determine the correct size values. Still not sure if what turned me off or some version of the namespace conflict mentioned in Mark's answer.

In addition, I did not use part of the sidekiq.yml tutorial, because the sidekiq wiki says that he does not like the new versions of rails. Instead, I set concurrency to 2 in the exec exec Procfile command, for example:

 worker: bundle exec sidekiq -c 2 

Hope this will be helpful to anyone who has a similar problem in the future! Thanks to everyone who tried to help.

+6
source

Just adding two cents here: in my case, I forgot to add the queue name to config / sidekiq.yml =]

+1
source

You need to configure the server to use the same namespace.

0
source

Source: https://habr.com/ru/post/976446/


All Articles