Created
March 29, 2019 16:54
-
-
Save lega911/08b2448e656b2825878e52af4875c074 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import redis | |
import time | |
import json | |
r = redis.Redis(host='localhost', port=6379, db=0) | |
for i in range(100): | |
print(i) | |
r.rpush('tasks', json.dumps({'task': i})) | |
time.sleep(0.5) |
This file contains hidden or 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
import redis | |
import json | |
import time | |
r = redis.Redis(host='localhost', port=6379, db=0) | |
while True: | |
task = json.loads(r.blpop('tasks')[1]) | |
print(task) | |
time.sleep(2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment