@@ -696,7 +696,6 @@ pub fn with_fetch_options(
696
696
network:: with_retry ( config, || {
697
697
with_authentication ( url, git_config, |f| {
698
698
let mut last_recv = 0.0 ; // in Byte
699
- let mut last_rate = 0.0 ; // in Byte/s
700
699
let mut last_update = Instant :: now ( ) ;
701
700
let mut rcb = git2:: RemoteCallbacks :: new ( ) ;
702
701
rcb. credentials ( f) ;
@@ -708,24 +707,20 @@ pub fn with_fetch_options(
708
707
} else {
709
708
// Receiving objects.
710
709
let duration = last_update. elapsed ( ) ;
711
- let ( recv, rate ) = if duration > Duration :: from_secs ( 1 ) {
712
- let recv = stats . received_bytes ( ) as f32 ;
713
- let rate = ( recv - last_recv ) / duration . as_secs_f32 ( ) ;
710
+ let recv = stats . received_bytes ( ) as f32 ;
711
+ let rate = ( recv - last_recv ) / duration . as_secs_f32 ( ) ;
712
+ if duration > Duration :: from_secs ( 3 ) {
714
713
last_recv = recv;
715
- last_rate = rate;
716
714
last_update = Instant :: now ( ) ;
717
- ( recv, rate)
718
- } else {
719
- ( last_recv, last_rate)
720
- } ;
715
+ }
721
716
fn format_bytes ( bytes : f32 ) -> ( & ' static str , f32 ) {
722
717
static UNITS : [ & str ; 5 ] = [ "" , "K" , "M" , "G" , "T" ] ;
723
718
let i = ( bytes. log2 ( ) / 10.0 ) . min ( 4.0 ) as usize ;
724
719
( UNITS [ i] , bytes / 1024_f32 . powi ( i as i32 ) )
725
720
}
726
721
let ( rate_unit, rate) = format_bytes ( rate) ;
727
722
let ( unit, recv) = format_bytes ( recv) ;
728
- format ! ( " | {:.2}{}iB | {:.2}{}iB/s" , recv, unit, rate, rate_unit)
723
+ format ! ( ", {:.2}{}iB | {:.2}{}iB/s" , recv, unit, rate, rate_unit)
729
724
} ;
730
725
progress
731
726
. tick ( stats. indexed_objects ( ) , stats. total_objects ( ) , & msg)
0 commit comments