resque/resque — pull request #1193 by saizai (2014-03-14 19:44:22+00:00)
Title: Fix child reuse of Redis process

The error `#` arises during `prune_dead_workers`, which invokes Redis and occurs before the `before_fork` hook could let a user reconnect.

Because the worker has a new pid, it conflicts with the pid of the redis client (which is based on the calling process, eg rake), which causes `Redis::Client#ensure_connected` to raise an error.

This patch simply checks whether all the pids are aligned (as they're supposed to be), and if not, reconnects to redis.