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

[Feature request] Display bytes transferred when updating <crates.io> index #8483

Closed
gendx opened this issue Jul 14, 2020 · 1 comment · Fixed by #9395
Closed

[Feature request] Display bytes transferred when updating <crates.io> index #8483

gendx opened this issue Jul 14, 2020 · 1 comment · Fixed by #9395
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`

Comments

@gendx
Copy link

gendx commented Jul 14, 2020

Describe the problem you are trying to solve
When updating an index such as crates.io on a slow network connection (e.g. tethering from a mobile device), the "Fetch" step is often quite slow. In particular on a fresh install of Cargo this is often the slowest step.

For now, there is a progress bar showing a percentage of progress, such as the following.

      Fetch [============================>                          ]  53.00%

However, this percentage is quite opaque.

Describe the solution you'd like
It would be useful to also display:

  1. how many bytes have been received,
  2. how many bytes are remaining,
  3. the current throughput.

Notes
I believe the relevant code that updates the progress bar is the following:

rcb.transfer_progress(|stats| {
progress
.tick(stats.indexed_objects(), stats.total_objects())
.is_ok()
});

In particular, the relevant information (stats) seem to come from a callback from libgit2 (git2::Progress). This struct already contains a received_bytes() which would provide information for (1). I'm not sure how to get the total/remaining bytes from libgit2, nor the throughput. But seeing how many bytes have been transferred would already be a great improvement.

@gendx gendx added the C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted` label Jul 14, 2020
@Eh2406
Copy link
Contributor

Eh2406 commented Jul 14, 2020

That sounds reasonable to me!

@ehuss ehuss added the A-console-output Area: Terminal output, colors, progress bar, etc. label Jul 29, 2020
@bors bors closed this as completed in 6701e33 Apr 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-console-output Area: Terminal output, colors, progress bar, etc. C-feature-request Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants