Commit c0618be
committed
fix(dashboard-api): async hygiene in routers/extensions.py
Three async-hygiene defects in routers/extensions.py:
- extension_logs and extensions_catalog called blocking urllib.urlopen
directly on the event-loop thread. With the Console modal polling
every 2s and a 30s agent timeout, one slow host-agent response
could stall the dashboard-api for up to 30s at a time.
- _call_agent, _call_agent_invalidate_compose_cache, and
_call_agent_compose_rename caught `except Exception`, swallowing
non-network programmer errors with a misleading "host agent
unreachable" log. Narrow to (URLError, HTTPError, OSError,
TimeoutError) and log the actual exception.
- _cleanup_stale_progress was dispatched via run_in_executor with a
discarded Future, so failures surfaced only as "Future exception
was never retrieved" warnings in stderr.
Offload blocking urllib calls via asyncio.to_thread (matching the
existing pattern in main.py's api_settings_env_save). Attach a
log-on-exception done-callback to the cleanup future.
Tests cover the URLError swallow path, the new re-raise behaviour on
non-network errors, and the cleanup callback logging.1 parent d5154c3 commit c0618be
2 files changed
Lines changed: 102 additions & 12 deletions
Lines changed: 42 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
475 | 475 | | |
476 | 476 | | |
477 | 477 | | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
478 | 490 | | |
479 | 491 | | |
480 | 492 | | |
| |||
487 | 499 | | |
488 | 500 | | |
489 | 501 | | |
490 | | - | |
491 | | - | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
492 | 507 | | |
493 | 508 | | |
494 | 509 | | |
| |||
503 | 518 | | |
504 | 519 | | |
505 | 520 | | |
506 | | - | |
| 521 | + | |
507 | 522 | | |
508 | | - | |
| 523 | + | |
| 524 | + | |
509 | 525 | | |
510 | 526 | | |
511 | 527 | | |
| |||
583 | 599 | | |
584 | 600 | | |
585 | 601 | | |
586 | | - | |
587 | | - | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
588 | 606 | | |
589 | 607 | | |
590 | 608 | | |
| |||
603 | 621 | | |
604 | 622 | | |
605 | 623 | | |
606 | | - | |
| 624 | + | |
607 | 625 | | |
608 | 626 | | |
609 | 627 | | |
| |||
645 | 663 | | |
646 | 664 | | |
647 | 665 | | |
648 | | - | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
649 | 676 | | |
650 | 677 | | |
651 | 678 | | |
| |||
752 | 779 | | |
753 | 780 | | |
754 | 781 | | |
| 782 | + | |
| 783 | + | |
755 | 784 | | |
756 | 785 | | |
757 | 786 | | |
758 | 787 | | |
759 | 788 | | |
760 | | - | |
| 789 | + | |
761 | 790 | | |
762 | 791 | | |
763 | 792 | | |
| |||
863 | 892 | | |
864 | 893 | | |
865 | 894 | | |
866 | | - | |
867 | 895 | | |
868 | | - | |
869 | | - | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
870 | 900 | | |
871 | 901 | | |
872 | 902 | | |
| |||
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2278 | 2278 | | |
2279 | 2279 | | |
2280 | 2280 | | |
| 2281 | + | |
| 2282 | + | |
| 2283 | + | |
| 2284 | + | |
| 2285 | + | |
| 2286 | + | |
| 2287 | + | |
| 2288 | + | |
| 2289 | + | |
| 2290 | + | |
| 2291 | + | |
| 2292 | + | |
| 2293 | + | |
| 2294 | + | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
| 2336 | + | |
| 2337 | + | |
| 2338 | + | |
| 2339 | + | |
| 2340 | + | |
0 commit comments