gitlabhq/gitlabhq — pull request #2386 by jirutka (2012-12-25 22:27:13+00:00)
Title: Fix shared Redis connection issue on Passenger

When you’re using Passenger with _smart-lv2_ (default) or _smart_ spawn method, Resque doesn’t recognize that it has been forked (due to caching) and should re-establish Redis connection. Then you can see this error message in log:
> Redis::InheritedError, Tried to use a connection from a child process without reconnecting. You need to reconnect to Redis after forking.`

Note that `Resque.after_fork { Resque.redis.client.reconnect }` is _not_ sufficient with Passenger’s smart spawn.

This solution is based on https://github.com/redis/redis-rb/wiki/redis-rb-on-Phusion-Passenger