perf(engine): avoid timed waits for Engine responses (#39486)

Signed-off-by: jthomson04 <jwillthomson19@gmail.com>
This commit is contained in:
jthomson04
2026-09-21 20:42:03 -07:00
committed by GitHub
parent 56fee88e23
commit 15ba54bd5d
2 changed files with 92 additions and 3 deletions
@@ -1835,9 +1835,13 @@ class TokenizerManager(TokenizerControlMixin, TokenizerManagerScoreMixin):
is_stream = getattr(obj, "stream", False)
while True:
try:
await asyncio.wait_for(
state.event.wait(), timeout=_REQUEST_STATE_WAIT_TIMEOUT
)
if request is None:
# Engine requests have no HTTP client to poll for disconnects.
await state.event.wait()
else:
await asyncio.wait_for(
state.event.wait(), timeout=_REQUEST_STATE_WAIT_TIMEOUT
)
except asyncio.TimeoutError:
if (
request is not None