asyncio1 [Python] asyncio example import asyncioqueue = asyncio.Queue()async def producer(): for i in range(3): await queue.put(f"update {i}") await asyncio.sleep(1) # 1초마다 상태 변경async def consumer(): while True: data = await queue.get() print("SSE Send:", data) if data == "update 2": breakasync def main(): await asyncio.gather(producer(), consumer())asyncio.run(main()) 2025. 6. 12. 이전 1 다음