leporo/tornado-redis — pull request #2 by maeldur (2012-05-12 22:44:56+00:00)
Title: fixing a blocking redis command hang

i noticed it was hanging on read_until. to solve this, i added an on_error_callback on the tornado iostream:

http://www.tornadoweb.org/documentation/_modules/tornado/iostream.html#IOStream.set_close_callback

and had it call the wrapped read_until callback(s) with no data if the socket closes.

the clients are then able to catch this exception using a tornado exception stack context and handle appropriately.

How to repro:
if you have a brpoplpush call being yielded and the redis server goes down, the callback is never called (even if you bring the redis server back up)