Skip to content

admin/upload_index: Use indicatif for progress reporting #4836

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

Merged
merged 1 commit into from
May 31, 2022

Conversation

Turbo87
Copy link
Member

@Turbo87 Turbo87 commented May 23, 2022

This PR uses https://github.com/console-rs/indicatif to display a progress bar while backfilling the HTTP-based index, with the main advantage of having a somewhat reasonable ETA display :)

/cc @arlosi

@Turbo87 Turbo87 added C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear A-backend ⚙️ labels May 23, 2022
@arlosi
Copy link
Contributor

arlosi commented May 23, 2022

Just a consideration: I'm not sure where the admin tasks run, but I'd expect it would need to support clearing the current line for a progress bar to work properly.

If we really get impatient, we could upload in parallel and probably get at least a 10x speedup 😀.

let crate_name = file.file_name().unwrap().to_str().unwrap();
let path = repo.index_file(crate_name);
if !path.exists() {
println!("skipping file `{}`", crate_name);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

it looks like when we call println!() while a progressbar is active it does not print the message, but instead freezes the progressbar and continues it on the next line. I guess it doesn't play well with the clearing of the current line.

Copy link
Member

@JohnTitor JohnTitor left a comment

Choose a reason for hiding this comment

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

The motivation looks reasonable to me!

@bors
Copy link
Contributor

bors commented May 28, 2022

☔ The latest upstream changes (presumably 30e6673) made this pull request unmergeable. Please resolve the merge conflicts.

@Turbo87
Copy link
Member Author

Turbo87 commented May 31, 2022

I'm not sure where the admin tasks run, but I'd expect it would need to support clearing the current line for a progress bar to work properly.

I tried it out on Heroku and it seems to work as expected :)

@Turbo87 Turbo87 merged commit 64feb48 into rust-lang:master May 31, 2022
@Turbo87 Turbo87 deleted the progress branch May 31, 2022 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-backend ⚙️ C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants