[Bugfix][KV Offload] Skip cleaned-up async lookup batches (#55075)

Signed-off-by: Alex <jihui.huang@daocloud.io>
Co-authored-by: OpenAI Codex <noreply@openai.com>
Co-authored-by: Or Ozeri <oro@il.ibm.com>
This commit is contained in:
AlexHuang
2026-09-06 13:27:46 +03:00
committed by GitHub
co-authored by OpenAI Codex Or Ozeri
parent a1541f5742
commit 9afb878a55
2 changed files with 21 additions and 3 deletions
+10 -3
View File
@@ -158,9 +158,16 @@ class AsyncLookupManager(ABC):
step's drain_results(). Safe to call with an empty batch (no-op).
"""
self._need_to_drain = True
if self._lookup_batch:
self._lookup_queue.put(self._lookup_batch)
self._lookup_batch = []
batch = self._lookup_batch
self._lookup_batch = []
batch = [
(key, req_context, generation)
for key, req_context, generation in batch
if (state := self._lookup_state.get(key)) is not None
and state.generation == generation
]
if batch:
self._lookup_queue.put(batch)
def drain_results(self) -> None:
"""Apply pending worker results to _lookup_state.