feat(lsp): add per-dependency timeout isolation for registry fetches#46
Merged
feat(lsp): add per-dependency timeout isolation for registry fetches#46
Conversation
Prevents slow packages from blocking the entire fetch queue by wrapping
each package fetch in an individual timeout. Previously, a single slow
package (30s+) would block a concurrency slot and delay all other packages.
Changes:
- Add configurable `fetch_timeout_secs` (default: 5s, range: 1-300s)
- Add configurable `max_concurrent_fetches` (default: 20, range: 1-100)
- Wrap each registry fetch in `tokio::time::timeout()`
- Add bounds validation with clamping for security
- Add comprehensive tests for timeout behavior and edge cases
Performance impact:
- Before: 50-dep manifest with 1 slow package → 30+ seconds
- After: 50-dep manifest with 1 slow package → ~5 seconds
User configuration:
```json
{
"cache": {
"fetch_timeout_secs": 10,
"max_concurrent_fetches": 50
}
}
```
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #46 +/- ##
==========================================
- Coverage 85.04% 84.99% -0.05%
==========================================
Files 56 56
Lines 15409 15652 +243
==========================================
+ Hits 13105 13304 +199
- Misses 2304 2348 +44
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
- Add Loading Indicators feature to README - Document fetch_timeout_secs and max_concurrent_fetches options - Document loading_indicator configuration section - Add Configuration Reference table with all new options - Fix outdated ecosystem registration path in templates/README.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Problem
Previously,
fetch_latest_versions_parallel()usedbuffer_unordered(10)without timeout isolation. If one package registry was slow (30+ seconds), it would block a concurrency slot and delay processing of all other packages.Solution
Performance Impact
Configuration
{ "cache": { "fetch_timeout_secs": 10, "max_concurrent_fetches": 50 } }Test plan
test_fetch_latest_versions_parallel_with_timeout- Timeout workstest_fetch_latest_versions_parallel_fast_packages_not_blocked- Fast packages completetest_fetch_partial_success_with_mixed_outcomes- Error handlingtest_cache_config_fetch_timeout_clamped_min/max- Bounds validationtest_cache_config_max_concurrent_clamped_min/max- Bounds validation