Skip to content

Instantly share code, notes, and snippets.

@lega911
Created March 29, 2019 16:54
Show Gist options
  • Save lega911/08b2448e656b2825878e52af4875c074 to your computer and use it in GitHub Desktop.
Save lega911/08b2448e656b2825878e52af4875c074 to your computer and use it in GitHub Desktop.
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)
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