Abort when coroutine is cancelled (#1020)
This commit is contained in:
parent
64ca424e75
commit
b9fe4616f9
@ -395,8 +395,9 @@ class AsyncLLMEngine:
|
|||||||
|
|
||||||
async for request_output in stream:
|
async for request_output in stream:
|
||||||
yield request_output
|
yield request_output
|
||||||
except Exception as e:
|
except (Exception, asyncio.CancelledError) as e:
|
||||||
# If there is an exception, abort the request.
|
# If there is an exception or coroutine is cancelled, abort the
|
||||||
|
# request.
|
||||||
self._abort(request_id)
|
self._abort(request_id)
|
||||||
raise e
|
raise e
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user