Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When does Resque open a redis connection?

I've been running into Redis::TimeoutError: Connection timed out errors on Heroku, and I'm trying to pin down the problem. I'm only using Resque to connect to redis, so I'm wondering how Resque connects to redis:

  1. When does Resque connect to redis? When a worker is started?
  2. How long do redis connections last, typically?

It's unclear to me when connections are made and how long they last. Can anyone shed some light on this for me? Thanks!

like image 373
user3082031 Avatar asked Apr 12 '26 04:04

user3082031


1 Answers

Typically connections to Redis from Rails apps are established lazily, when the connection is first time used. For troubleshooting, sometimes it is useful to force the connection by adding Redis PING (http://redis.io/commands/ping) in the initializer code.

Once connection is established it will be maintained forever. If connection is dropped, an attempt to reconnect will happen next time it is used.

Also, be aware that as of early 2015, Heroku had an ongoing issue establishing connections to Redis instances on AWS, as the connections would occasionally time out. Heroku support is aware of that, so you may be able to get some help reaching out to them.

like image 71
quarterdome Avatar answered Apr 15 '26 06:04

quarterdome



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!