Skip to content

Commit

Permalink
comment about caveat of current transfer rate refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
weihanglo committed Apr 28, 2021
1 parent 9df531b commit e4d4347
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/cargo/sources/git/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,16 @@ pub fn with_fetch_options(
)
} else {
// Receiving objects.
//
// # Caveat
//
// Progress bar relies on git2 calling `transfer_progress`
// to update its transfer rate, but we cannot guarantee a
// periodic call of that callback. Thus if we don't receive
// any data for, say, 10 seconds, the rate will get stuck
// and never go down to 0B/s.
// In the future, we need to find away to update the rate
// even when the callback is not called.
let now = Instant::now();
// Scrape a `received_bytes` to the counter every 300ms.
if now - last_update > Duration::from_millis(300) {
Expand Down

0 comments on commit e4d4347

Please sign in to comment.