Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize fetch_crate_cratesio for exact version #1089

Merged
merged 1 commit into from May 25, 2023

Conversation

NobodyXu
Copy link
Member

If version_req requests a specific version instead of a range, then there is no need to pull all versions available from https://crates.io/api/v1/crates

Signed-off-by: Jiahao XU Jiahao_XU@outlook.com

@NobodyXu NobodyXu marked this pull request as draft May 25, 2023 12:28
@NobodyXu
Copy link
Member Author

There's one issue with the optimisation: If the version requested by user is yanked, it would continue to fetch it instead of rejecting it.

This is inconsistent with the existing general implementation, but given that users specifically requested that version, maybe it's ok for our algorithm to fetch and try installing it, even if it is yanked?

Though in that case maybe a warning is needed or rejected, which means we would still need a http request into https://crates.io/api/v1/crates/$crate/$version , but it does not have to fetch information for all versions.

If `version_req` requests a specific version instead of a range, then
there is no need to pull all versions available from
https://crates.io/api/v1/crates

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
@NobodyXu NobodyXu force-pushed the optimize/fetch_crate_cratesio branch from 15a13df to 6fb8919 Compare May 25, 2023 12:43
@NobodyXu
Copy link
Member Author

I've fixed the issue by querying https://crates.io/api/v1/crates/$crate/$version

@NobodyXu NobodyXu marked this pull request as ready for review May 25, 2023 12:46
@NobodyXu NobodyXu requested a review from passcod May 25, 2023 12:47
@NobodyXu NobodyXu added this pull request to the merge queue May 25, 2023
Merged via the queue into main with commit e96477a May 25, 2023
24 checks passed
@NobodyXu NobodyXu deleted the optimize/fetch_crate_cratesio branch May 25, 2023 13:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants