From 3d744f2d0dd54424160cdcc6b7574745fa886705 Mon Sep 17 00:00:00 2001 From: Wenzhe Xue Date: Tue, 4 Jun 2024 10:18:14 -0700 Subject: [PATCH] update function name to finalize to gather all tasks --- examples/logging/openai_async_stream_logging.py | 4 ++-- log10/_httpx_utils.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/logging/openai_async_stream_logging.py b/examples/logging/openai_async_stream_logging.py index 526cbebf..4d96faf5 100644 --- a/examples/logging/openai_async_stream_logging.py +++ b/examples/logging/openai_async_stream_logging.py @@ -3,7 +3,7 @@ import openai from openai import AsyncOpenAI -from log10._httpx_utils import gather_pending_async_tasks +from log10._httpx_utils import finalize from log10.load import log10 @@ -20,7 +20,7 @@ async def main(): ) async for chunk in stream: print(chunk.choices[0].delta.content or "", end="", flush=True) - await gather_pending_async_tasks() + await finalize() asyncio.run(main()) diff --git a/log10/_httpx_utils.py b/log10/_httpx_utils.py index dc191d55..50a4b246 100644 --- a/log10/_httpx_utils.py +++ b/log10/_httpx_utils.py @@ -523,7 +523,7 @@ async def handle_async_request(self, request: httpx.Request) -> httpx.Response: return response -async def gather_pending_async_tasks(): +async def finalize(): pending = asyncio.all_tasks() pending.remove(asyncio.current_task()) await asyncio.gather(*pending)