artsy/flux — pull request #38 by macreery (2013-04-02 16:13:56+00:00)
Title: Fix /sync timeouts

Requests to **/sync** were unpredictably failing with `Redis::TimeoutError`, at two points:

* First, on the call to `app_redis.flushdb` in `SyncDatabase.perform`.
* Second, on the call to `app_redis.info`, in the same method.

The first failure is interesting, because it would happen every *other* request (since `flushdb` would only time out on a "full" database. The second failure is important, since whenever it happened, the Redis instance would remain in a slave state (`app_redis.slaveof('no', 'one')` would never be reached).

An arguably more robust/correct solution would be to use two connections here: one for the `flushdb`, with a very long timeout, and another for the `info`, with a short timeout (but wrapping the `info` call in a `rescue` block. This is simpler, and probably sufficient.