Abort when coroutine is cancelled (#1020)

This commit is contained in:
Jerry Yang 2023-09-15 08:40:18 +08:00 committed by GitHub
parent 64ca424e75
commit b9fe4616f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -395,8 +395,9 @@ class AsyncLLMEngine:
async for request_output in stream:
yield request_output
except Exception as e:
# If there is an exception, abort the request.
except (Exception, asyncio.CancelledError) as e:
# If there is an exception or coroutine is cancelled, abort the
# request.
self._abort(request_id)
raise e