async def receive_data(q: asyncio.Queue, task: Task): while True: data = await q.get() print(data) task.cancel() break