[Twisted-Python] Twisted + Redis-py + Connection Pooling

Itamar Turner-Trauring itamar at futurefoundries.com
Fri Sep 28 21:28:09 EDT 2012


One problem in the code: it kinda seems you want to receive lines, but
you're overriding dataReceived instead of lineReceived in
RedisWorkProtocol. At the very minimum you shouldn't assume dataReceived is
called with the exact bytes that were written on the other side.

More importantly, I assume redis-py is blocking. Calling a blocking API
from Twisted will block the reactor, preventing any other code from running
until it the API call returns. As such it means you can't have two queries
to redis running at the same time, unless you use something like
deferToThread, or a redis client that supports Twisted directly.

-- 
Itamar Turner-Trauring, Future Foundries LLC
http://futurefoundries.com/ — Twisted consulting, training and support.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://twistedmatrix.com/pipermail/twisted-python/attachments/20120928/01fe17bb/attachment.htm 


More information about the Twisted-Python mailing list