From redis-py's documentation:
"Behind the scenes, get_message() uses the system's 'select' module to quickly poll the connection's socket. If there's data available to be read, get_message() will read it, format the message and return it or pass it to a message handler. If there's no data to be read, get_message() will immediately return None. This makes it trivial to integrate into an existing event loop inside your application."
And it gives an example:
while True:
message = p.get_message()
if message:
# do something with the message
time.sleep(0.001) # be nice to the system :)
In the context of Tornado (which has a main IOLoop thread), how do I utilize get_message() so that redis-py's subscriber operates in an asynchronous fashion? Do I need to register a periodic callback on Tornado's IOLoop such that get_message() polls the connection periodically?