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

Migrate to 2018 edition #292

Merged
merged 4 commits into from
May 8, 2019
Merged

Migrate to 2018 edition #292

merged 4 commits into from
May 8, 2019

Conversation

DCjanus
Copy link
Contributor

@DCjanus DCjanus commented May 8, 2019

There was function get_with_timeout, re-create a client each time this function is called, and "timeout" always 'default', I merged these two functions and reuse reqwest::Client to reuse TCP connection.

Other mirror change:

  • move to 2018 edition
  • work with rustfmt

Recommended review way: commit by commit.

Copy link
Collaborator

@ordian ordian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I have one concern wrt url handling (inline comment). Also could you merge with master to fix CI tests?

src/fetch.rs Outdated Show resolved Hide resolved
@DCjanus
Copy link
Contributor Author

DCjanus commented May 8, 2019

The purpose of this PR is to reduce the time of cargo upgrade, because of Chinese network block, every cargo upgrade takes a lot of time.

Maybe we should query local registry index rather than query HTTP API? I'd like to handle this.

@ordian
Copy link
Collaborator

ordian commented May 8, 2019

The purpose of this PR is to reduce the time of cargo upgrade

I see. Does it help though, we still make the same amount of requests?

Maybe we should query local registry index rather than query HTTP API?

I think we should eventually use cargo offline mode

@DCjanus
Copy link
Contributor Author

DCjanus commented May 8, 2019

Does it help though, we still make the same amount of requests?

Less connection with less TCP handshake, that's do helpful, especially if the network is bad. But, never mind, you shouldn't spend too much effort on my special situation.

I think we should eventually use cargo offline mode

I am not very familiar with Cargo's offline mode. My current idea is to use the SourceConfigMap#load in the cargo crate to get the Source and use the query method to get all versions of a crate.

Of cause, update index in the begin.

But temporarily I don't known how to support the alternate registry

@ordian ordian changed the title Reuse reqwest::Client Migrate to 2018 edition May 8, 2019
@ordian
Copy link
Collaborator

ordian commented May 8, 2019

@DCjanus could you open a separate issue for querying local registry index/offline mode? Note, that we don't want to depend on cargo as a lib (because it's huge), but instead the plan is to eventually integrate cargo-edit into cargo (rust-lang/cargo#5586).

@DCjanus
Copy link
Contributor Author

DCjanus commented May 8, 2019

Thanks for your help!

@ordian
Copy link
Collaborator

ordian commented May 8, 2019

bors r+

bors bot added a commit that referenced this pull request May 8, 2019
292: Migrate to 2018 edition r=ordian a=DCjanus

There was function `get_with_timeout`, re-create a client each time this function is called, and "timeout" always 'default', I merged these two functions and reuse reqwest::Client to reuse TCP connection.

Other mirror change:

+ move to 2018 edition
+ work with rustfmt

Recommended review way: commit by commit.

Co-authored-by: DCjanus <[email protected]>
@bors
Copy link
Contributor

bors bot commented May 8, 2019

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.

2 participants