Last active
September 18, 2019 13:42
-
-
Save kristoff-it/eeb4c9531962927e1915e45799292ac5 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
last_id = '$' | |
while True: | |
events = await pool.xread(['wins_stream'], latest_ids=[last_id], timeout=0, count=10) | |
tasks = [] | |
for _, e_id, e in events: | |
winner = e['winner'] | |
tasks.append(add_new_win(pool, winner)) | |
last_id = e_id | |
await asyncio.gather(*tasks) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment