Home > Blockchain >  Heroku redis/sidekiq Connection timed out - user specified timeout error
Heroku redis/sidekiq Connection timed out - user specified timeout error

Time:02-02

This is an issue that happened after upgrading my Redis instance version on Heroku using heroku redis:upgrade The error happened when Sidekiq tried to connect to Redis:

Connection timed out - user specified timeout

After reading this guide: https://github.com/mperham/sidekiq/wiki/Using-Redis#life-in-the-cloud I thought the problem might be in the network connection, so I tried increasing the network timeout in config/initializers/sidekiq.rb like this: config.redis = { network_timeout: 5 }

Unfortunately this did not help, it only increased the time that it takes to create the connection, but the same error was still occurring in the end.

CodePudding user response:

I noticed that after upgrading the Redis instance version, Heroku had not updated the REDIS_URL config var to match the new redis url. So, the URL in the config var:

heroku config:get REDIS_URL

was different from the one returned by:

heroku redis:credentials

So my solution was as per the following guide: https://devcenter.heroku.com/articles/managing-heroku-redis-using-cli#redis-credentials to reset Redis the credentials:

heroku redis:credentials --reset

With this command, new credentials are created for the Redis instance and the related config vars on the Heroku application are automatically updated.

  • Related