Created
September 5, 2017 14:09
-
-
Save briandeheus/afe1a985df8ebb2207a0a228bb17a4d0 to your computer and use it in GitHub Desktop.
Distributed Message Queue in Python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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