Commit 837ef2d
committed
fix: address Copilot AI review - timeouts and CancelledError handling
Changes based on Copilot AI review (3 issues):
1. Increased thread join timeout (Issue #1):
- Changed from 2 to 5 seconds
- Made proportional to cleanup timeout
- Defined as class constant _THREAD_JOIN_TIMEOUT
2. Handle asyncio.CancelledError explicitly (Issue aden-hive#2):
- Added separate except clause for CancelledError
- Logs specific warning for cancelled cleanup
- Re-raises CancelledError as per asyncio best practices
- Added for both session and stdio_context cleanup
3. Increased cleanup timeout to match connection timeout (Issue aden-hive#3):
- Changed from 5 to 10 seconds (matches _connect_stdio timeout)
- Defined as class constant _CLEANUP_TIMEOUT
- Prevents incomplete cleanup with slow MCP servers1 parent a39afbe commit 837ef2d
1 file changed
Lines changed: 17 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
389 | 389 | | |
390 | 390 | | |
391 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
392 | 396 | | |
393 | 397 | | |
394 | 398 | | |
| |||
404 | 408 | | |
405 | 409 | | |
406 | 410 | | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
407 | 415 | | |
408 | 416 | | |
409 | 417 | | |
| |||
413 | 421 | | |
414 | 422 | | |
415 | 423 | | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
416 | 428 | | |
417 | 429 | | |
418 | 430 | | |
| |||
434 | 446 | | |
435 | 447 | | |
436 | 448 | | |
437 | | - | |
| 449 | + | |
438 | 450 | | |
439 | 451 | | |
440 | | - | |
441 | | - | |
| 452 | + | |
| 453 | + | |
442 | 454 | | |
443 | 455 | | |
444 | 456 | | |
| |||
462 | 474 | | |
463 | 475 | | |
464 | 476 | | |
465 | | - | |
| 477 | + | |
466 | 478 | | |
467 | | - | |
| 479 | + | |
468 | 480 | | |
469 | 481 | | |
470 | 482 | | |
| |||
0 commit comments