-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Ensure Client.close() cleans up client context appropriately #643
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
Conversation
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.
Pull Request Overview
The purpose of this PR is to ensure that the client context is cleaned up appropriately when close() is called, addressing issues identified in #635. Key changes include the addition of a new test for handling concurrent tasks in the proxy, refactoring of the client context management in client.py by introducing _connect and _disconnect methods, and the integration of new concurrency primitives.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| tests/server/test_proxy.py | Added a test to verify correct handling of concurrent tasks |
| src/fastmcp/client/client.py | Refactored context management to improve session cleanup and prevent race conditions |
Ensure close() cleans up client context appropriately
Follow-up to #635 that fixes
Client.close()to manage concurrency properly and also adds a test for Client concurrency