Skip to content

Instantly share code, notes, and snippets.

@briandeheus
Created September 5, 2017 14:09
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save briandeheus/afe1a985df8ebb2207a0a228bb17a4d0 to your computer and use it in GitHub Desktop.
Save briandeheus/afe1a985df8ebb2207a0a228bb17a4d0 to your computer and use it in GitHub Desktop.
Distributed Message Queue in Python
from redis import Redis
import time
redis = Redis()
def work_from_queue(queue):
while True:
res = redis.rpop(queue)
if res:
yield res.decode('utf-8')
else:
time.sleep(0.1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment