Question

Trying to send emails with Sidekiq using Redis_To_Go, but my worker keeps crashing. I've done everything I could find, and I'm sure this is a small issue. Though I can't figure it out!

./Procfile.txt:

web: bundle exec rails server -p $PORT
worker: bundle exec sidekiq -c 5 -v

./config/initializers/redis.rb

$redis = Redis::Namespace.new("ihms_env_app", :redis => Redis.new)

uri = URI.parse(ENV["REDISTOGO_URL"])
REDIS = Redis.new(:url => ENV['REDISTOGO_URL'])

I've scaled the workers from 0 to 1

$ heroku ps
=== web (1X): `bin/rails server -p $PORT -e $RAILS_ENV`
web.1: up 2014/05/08 10:46:56 (~ 7m ago)

=== worker (1X): `bundle exec rake jobs:work`
worker.1: crashed 2014/05/08 10:47:00 (~ 7m ago)

log

heroku[worker.1]: State changed from crashed to starting
heroku[worker.1]: State changed from starting to up
heroku[worker.1]: Starting process with command `bundle exec rake jobs:work`
app[worker.1]: 
app[worker.1]: rake aborted!
app[worker.1]: Don't know how to build task 'jobs:work'

in console, I've run

heroku config:set REDIS_PROVIDER=REDISTOGO_URL
Was it helpful?

Solution

Hmm.

Your output from heroku ps and the logs indicates that you're trying, and failing, to run a rake task called "jobs:work".

What happens when you run: bundle exec rake jobs:work in your local directory? I'm going to guess it fails?

The Procfile you provide contradicts your logs. It has Sidekiq and not rake as the command. Are you sure you've checked it in to to your git repo and deployed it?

OTHER TIPS

Looks like you need a conditional initializer in your redis.rb file, such as:

if ENV["REDISCLOUD_URL"]
    uri = URI.parse(ENV["REDISCLOUD_URL"])
    $redis = Redis.new(:host => uri.host, :port => uri.port, :password => uri.password)
end

For more details, see my answer to Redis looking for env redis url variable not sure where to put env variable bad URI(is not URI?): (URI::InvalidURIError)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top