perf: parallelize jsDelivr README fallback probes#2384
perf: parallelize jsDelivr README fallback probes#2384trivikr wants to merge 5 commits intonpmx-dev:mainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThe PR changes server/utils/readme-loaders.ts to fetch candidate README filenames from jsDelivr in batches of three concurrently using Promise.all. fetchReadmeFromJsdelivr now returns the first successful body found within an earliest successful batch; failed fetches and non-OK responses yield null. A new internal buildReadmeFetchCandidates avoids duplicated candidates when a specific readmeFilename is provided. resolvePackageReadmeSource first tries the explicit readmeFilename alone, then falls back to the batched candidate list. Tests were added/expanded to cover batching, concurrency and candidate ordering. No exported signatures changed. Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 1✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Also updated PR to fetch provided readme before starting the fallback batch in 72bb0b2 |
🔗 Linked issue
N/A
🧭 Context
README fallback probing in
server/utils/readme-loaders.tswas strictly sequential. On cache misses, packages with missing or nonstandard README filenames could pay for several failed jsDelivr requests before the loader found the right file or gave up, which made worst-case README render time noticeably slower than necessary.📚 Description
This changes the jsDelivr README fallback path to reduce that long-tail latency while keeping the fallback behavior conservative.
readmeFilenamefirst when it exists.test/unit/server/utils/readme-loaders.spec.ts.