gamechanger/dockets — pull request #34 by tleach (2014-03-22 01:13:49+00:00)
Title: Use BRPOPLPUSH instead of RPOPLPUSH with a sleep()

@thieman cc @byels

Right now we effectively "short poll" Redis for new items with a big sleep in between polls. This is shitty for a few reasons:
- it means we can't easily use queues to deliver a "near instant" processing response, e.g. for confirmation SMS delivery, stat recalc on edit.
- I'm reasonably convinced it leads to queues building up big backlogs in between polls, an effect which gets worse the fewer workers there are.

BRPOPLPUSH makes us effectively long poll. We still timeout every `wait_time` seconds, so we're not hanging indefinitely (Dockets used to do this back in the day) but the difference rather than blocking on a useless sleep statement, we are blocking on a instant response from Redis.