From ce70593abe2657b17a28c9534aa5577cf6532642 Mon Sep 17 00:00:00 2001 From: TianyeDong Date: Sat, 20 Jun 2026 19:32:32 -0400 Subject: [PATCH] refactor(miles): inline await in _ray_get, drop _await_ref helper _await_ref(ref) was just `return await ref` wrapped behind a redundant function-local `import asyncio` (the module already imports asyncio, and the helper did not use it). Ray ObjectRefs are awaitable, so _ray_get can await them directly and gather the list form without the indirection. Co-Authored-By: Claude Opus 4.8 --- rlix/pipeline/miles_model_update_service.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/rlix/pipeline/miles_model_update_service.py b/rlix/pipeline/miles_model_update_service.py index 6371f38..d3846ca 100644 --- a/rlix/pipeline/miles_model_update_service.py +++ b/rlix/pipeline/miles_model_update_service.py @@ -460,14 +460,8 @@ async def _ray_get(refs): just delegate. """ if isinstance(refs, list): - return await asyncio.gather(*[_await_ref(r) for r in refs]) - return await _await_ref(refs) - - -async def _await_ref(ref): - import asyncio # noqa: F401 -- module-level import handled below - - return await ref + return await asyncio.gather(*refs) + return await refs __all__ = ["SyncSessionPlan", "MilesModelUpdateService"]