Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR removes unnecessary pass statements from the codebase. These statements serve no functional purpose as they appear after other statements in blocks that already contain executable code.
- Removes redundant
passstatements from exception handlers and try blocks - Cleans up code in mcp_utils.py, dictionary_file.py, logbook.py, and main.py
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| mcp_utils.py | Removes two pass statements from exception handling blocks that already contain other statements |
| mcp_servers/memcache/memcache_backend/dictionary_file.py | Removes pass statement from try block after file operations |
| mcp_servers/logbook/logbook.py | Removes pass statement from try block after file operations |
| main.py | Removes pass statement from except block that already logs an error |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| logging.error(f"RuntimeError in mcp session task: {e}") | ||
| except asyncio.CancelledError as e: | ||
| logging.error(f"Timeout on main session task: {e}") |
There was a problem hiding this comment.
The asyncio.CancelledError exception is being caught and only logged, which prevents proper task cancellation. CancelledError should typically be re-raised to allow graceful cancellation of the async task. Consider adding raise after the logging statement, or remove this except block entirely to let the exception propagate.
See below for a potential fix:
logging.error(f"Timeout on cleanup for mcp server: {server._name}")
raise
finally:
mcp_servers.remove(s)
except RuntimeError as e:
logging.error(f"RuntimeError in mcp session task: {e}")
except asyncio.CancelledError as e:
logging.error(f"Timeout on main session task: {e}")
raise
|
@m-y-mo Yeah sure 👍 Just incorporate it. |
No description provided.