Skip to content

Commit

Permalink
Reraise cancellation error as expected by asyncio (#137)
Browse files Browse the repository at this point in the history
  • Loading branch information
binarybana authored Jan 2, 2024
1 parent 6d79c1d commit eb2be38
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions serve/mlc_serve/engine/async_connector.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ async def generate(self, request: Request) -> AsyncIterator[RequestOutput]:
LOG.info("AsyncEngineConnector.generate iterator cancelled.", request_id=request.request_id)
await asyncio.shield(asyncio.to_thread(self.engine.cancel, request.request_id))
LOG.info("AsyncEngineConnector.generate request sucessfully cancelled.", request_id=request.request_id)
raise
finally:
LOG.info("AsyncEngineConnector.generate removing request from result queue.", request_id=request.request_id)
self.result_queues.pop(request.request_id, None)
Expand Down

0 comments on commit eb2be38

Please sign in to comment.