Sidekiq handling with local redis but not with remote

I have a RoR app with background jobs using ever and sidekiq gems.

In the development environment, when I run sidekiq with a local redis instance (on the local host), the work continues to run without problems. But when I switch to a remote instance of redis (Heroku add-on) and restart sidekiq, it says that it started to process, but nothing happens and the workers are not doing any tasks.

Here is my config / schedule.rb (for each gem)

every 2.minutes do rake "crawler:crawl" end 

Here are my /redis.rb initializers:

 Sidekiq.configure_server do |config| config.redis = { :url => 'redis://user: pass@spinyfin.redistogo.com :9098/' } end Sidekiq.configure_client do |config| config.redis = { :url => 'redis://user: pass@spinyfin.redistogo.com :9098/' } end 

If I comment on the contents in redis.rb and run a local instance of redis, jobs are processed normally. But when I use this remote instance of redis, it appears, and then nothing is processed:

 2013-11-29T15:09:26Z 95156 TID-ov6y7e14o INFO: Booting Sidekiq 2.13.0 using redis://redistogo: user@spinyfin.redistogo.com :9098/ with options {} 2013-11-29T15:09:26Z 95156 INFO: Running in ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-darwin11.4.2] 2013-11-29T15:09:26Z 95156 INFO: See LICENSE and the LGPL-3.0 for licensing details. 2013-11-29T15:09:26Z 95156 INFO: Starting processing, hit Ctrl-C to stop 
+6
source share
2 answers

You may be connecting to the wrong redis database or not connected at all. In my applications, I use redis url without a trailing slash. In your case:

This is for database "0"

 redis://user: pass@spinyfin.redistogo.com :9098 

And this is for database "1"

 redis://user: pass@spinyfin.redistogo.com :9098/1 
+1
source

I use the REDIS_URL environment variable to make sure everything uses the same Redis.

Re: Heroku - I just read this one here when I was looking for my solution:

If you are working on Heroku, you cannot rely on config/database.yml because this platform uses the DATABASE_URL environment variable to determine the database connection configuration. Heroku overwrites database.yml during slug compilation so that it reads from DATABASE_URL .

+1
source

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