@@ -18,7 +18,7 @@ pub fn default_sqlite_sha_file_path(_network: &BitcoinNetwork) -> String {
18
18
format ! ( "hord.sqlite.sha256" ) . to_lowercase ( )
19
19
}
20
20
21
- pub async fn download_sqlite_file ( config : & Config , ctx : & Context ) -> Result < ( ) , String > {
21
+ pub async fn download_sqlite_file ( config : & Config , _ctx : & Context ) -> Result < ( ) , String > {
22
22
let mut destination_path = config. expected_cache_path ( ) ;
23
23
std:: fs:: create_dir_all ( & destination_path) . unwrap_or_else ( |e| {
24
24
println ! ( "{}" , e. to_string( ) ) ;
@@ -61,12 +61,13 @@ pub async fn download_sqlite_file(config: &Config, ctx: &Context) -> Result<(),
61
61
} ) ;
62
62
63
63
if res. status ( ) == reqwest:: StatusCode :: OK {
64
- let mut progress_bar = MappingBar :: with_range ( 0i64 , 4_800_001_704 ) ;
65
- progress_bar. set_len ( 40 ) ;
66
- info ! (
67
- ctx . expect_logger ( ) ,
64
+ let mut progress_bar = MappingBar :: with_range ( 0i64 , 5_400_000_000 ) ;
65
+ progress_bar. set_len ( 60 ) ;
66
+ let mut stdout = std :: io :: stdout ( ) ;
67
+ print ! (
68
68
"{}" , progress_bar
69
69
) ;
70
+ let _ = stdout. flush ( ) ;
70
71
let mut stream = res. bytes_stream ( ) ;
71
72
let mut progress = 0 ;
72
73
while let Some ( item) = stream. next ( ) . await {
@@ -75,15 +76,20 @@ pub async fn download_sqlite_file(config: &Config, ctx: &Context) -> Result<(),
75
76
progress_bar. set ( progress) ;
76
77
if progress_bar. has_progressed_significantly ( ) {
77
78
progress_bar. remember_significant_progress ( ) ;
78
- info ! (
79
- ctx. expect_logger( ) ,
80
- "{}" , progress_bar
79
+ print ! (
80
+ "\r {}" , progress_bar
81
81
) ;
82
+ let _ = stdout. flush ( ) ;
82
83
}
83
84
tx. send_async ( chunk. to_vec ( ) )
84
85
. await
85
86
. map_err ( |e| format ! ( "unable to download stacks event: {}" , e. to_string( ) ) ) ?;
86
87
}
88
+ print ! (
89
+ "\r "
90
+ ) ;
91
+ let _ = stdout. flush ( ) ;
92
+ println ! ( ) ;
87
93
drop ( tx) ;
88
94
}
89
95
0 commit comments