Created
July 4, 2016 10:41
-
-
Save Integralist/6f34e23f71340a1a23e846cd2f64cf32 to your computer and use it in GitHub Desktop.
Python Asyncio Loop Forever
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
import asyncio | |
async def listener(): | |
while True: | |
message = await sqs.poll() | |
if message: | |
asyncio.ensure_future(handle(message)) | |
async def handler(message): | |
await ... | |
loop = asyncio.get_event_loop() | |
asyncio.ensure_future(listener) | |
loop.run_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Web Socket version and Queue