Skip to content

Instantly share code, notes, and snippets.

@twidi
Forked from andymccurdy/gist:352095
Created April 1, 2010 17:33
Show Gist options
  • Save twidi/352112 to your computer and use it in GitHub Desktop.
Save twidi/352112 to your computer and use it in GitHub Desktop.
import threading
import Queue
q = Queue.Queue()
def worker():
while True:
msg = q.get(block=True)
# do stuff with the message
t = threading.Thread(target=worker)
t.setDaemon(True)
t.start()
for msg in redis.listen():
q.put(msg)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment