-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: handling client disconnect gracefully by propagating cancellation exception up to the chat completion handler #185
base: development
Are you sure you want to change the base?
Conversation
tests/test_cancellation.py
Outdated
|
||
|
||
@pytest.mark.parametrize("with_heartbeat", [True, False]) | ||
async def test_cancellation(with_heartbeat: bool): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please, extend this with the test:
1.Run chat completion
2.Inside of chat completion create nested tasks, that run forever
3.Cancel chat completion
4.Check that nested tasks are also canceled
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed, added more tests
aidial_sdk/utils/_cancel_scope.py
Outdated
async def __aenter__(self): | ||
return self | ||
|
||
async def __aexit__(self, et, exc, tb): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use the same naming, that official PEP introduces:
async def __aexit__(self, exc_type, exc, tb):
...
It's quite easy to confuse et
with something else, then exception type.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
c764571
to
4a62262
Compare
No description provided.