Sidekiq processing with local redis but not with remote
Asked Answered
E

2

6

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
Edson answered 29/11, 2013 at 15:25 Comment(2)
Were you able to find a solution for this?Maidinwaiting
Nope. Gave up. Switched to clockwork and resque gems.Carolynncarolynne
D
1

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
Dancer answered 15/1, 2014 at 21:43 Comment(0)
Q
1

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 the DATABASE_URL environment variable to determine the database connection configuration. Heroku overwrites the database.yml during slug compilation so that it reads from DATABASE_URL.

Quadrilateral answered 20/6, 2014 at 14:47 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.