Reputation: 861
I have a RoR app with background jobs using whenever and sidekiq gems.
In development environment when I launch sidekiq with local redis instance (on localhost) the job keeps getting executed without problems. But when I switch to a remote redis instance (Heroku add-on) and restart sidekiq, it says it started processing, but nothing happens and workers aren't doing any jobs.
Here's my config/schedule.rb (for whenever gem)
every 2.minutes do
rake "crawler:crawl"
end
Here's my initializers/redis.rb:
Sidekiq.configure_server do |config|
config.redis = { :url => 'redis://user:[email protected]:9098/' }
end
Sidekiq.configure_client do |config|
config.redis = { :url => 'redis://user:[email protected]:9098/' }
end
If I comment out the content in redis.rb and run a local redis instance, the jobs are processed normally. But when I use this remote redis instance, this shows up and then nothing gets processed:
2013-11-29T15:09:26Z 95156 TID-ov6y7e14o INFO: Booting Sidekiq 2.13.0 using redis://redistogo:[email protected]: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
Upvotes: 6
Views: 1800
Reputation: 3518
I use the environment variable REDIS_URL
to ensure that everything is using the same Redis.
Re: Heroku - I just read this here as I was searching for my own solution:
If you're running on Heroku, you can't rely on the
config/database.yml
as that platform relies on theDATABASE_URL
environment variable to determine the database connection configuration. Heroku overwrites thedatabase.yml
during slug compilation so that it reads fromDATABASE_URL
.
Upvotes: 1
Reputation: 472
Maybe you connecting to wrong redis database or not connected at all. In my apps I use redis url without trailing slash. In your case:
This is for database "0"
redis://user:[email protected]:9098
And this for database "1"
redis://user:[email protected]:9098/1
Upvotes: 1