Skip to content

Commit 1e044c5

Browse files
authored
refactor: smoother large file download&proxy (#463)
* refactor: smoother large file download&proxy * chore: more msg * chore: changelog * chore: fmt * logs: make get proxy info so user know it working * refactor: use multiple process bar * chore: fmt * fix: allow log&process bar mix * refactor: per review * chore: fmt
1 parent 80e1df8 commit 1e044c5

File tree

6 files changed

+246
-19
lines changed

6 files changed

+246
-19
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- smoother large file download&proxy support (#463)
1112

1213
### Fixed
1314
- When queriying GitHub for the list of releases, retrieve more items (#462)

Cargo.lock

Lines changed: 121 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,20 @@ rust-version = "1.74.1"
1515

1616
[dependencies]
1717
async-trait = "0.1.83"
18+
bytes = "1.8.0"
1819
clap = { version = "4.5.21", features = ["derive", "env"] }
1920
clap_complete = "4.5.38"
2021
directories = "5.0.1"
2122
env_logger = "0.11.5"
2223
flate2 = "1.0.35"
2324
guess_host_triple = "0.1.4"
25+
indicatif = "0.17.9"
26+
indicatif-log-bridge = "0.2.3"
27+
lazy_static = "1.0"
2428
log = "0.4.22"
2529
miette = { version = "7.3.0", features = ["fancy"] }
2630
regex = "1.11.1"
27-
reqwest = { version = "0.12.9", features = ["blocking", "socks"] }
31+
reqwest = { version = "0.12.9", features = ["blocking", "socks", "stream"] }
2832
retry = "2.0.0"
2933
serde_json = "1.0.133"
3034
strum = { version = "0.26.3", features = ["derive"] }
@@ -33,6 +37,7 @@ tempfile = "3.14.0"
3337
thiserror = "2.0.3"
3438
tokio = { version = "1.41.1", features = ["full"] }
3539
tokio-retry = "0.3.0"
40+
tokio-stream = "0.1.17"
3641
update-informer = "1.1.0"
3742
xz2 = "0.1.7"
3843
zip = "2.2.1"

src/lib.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ pub mod toolchain;
88
pub mod logging {
99
use env_logger::{Builder, Env, WriteStyle};
1010

11+
use crate::toolchain::PROCESS_BARS;
12+
1113
/// Initializes the logger
1214
pub fn initialize_logger(log_level: &str) {
13-
Builder::from_env(Env::default().default_filter_or(log_level))
15+
let logger = Builder::from_env(Env::default().default_filter_or(log_level))
1416
.format(|buf, record| {
1517
use std::io::Write;
1618
writeln!(
@@ -21,7 +23,13 @@ pub mod logging {
2123
)
2224
})
2325
.write_style(WriteStyle::Always)
24-
.init();
26+
.build();
27+
let level = logger.filter();
28+
// make logging and process bar no longer mixed up
29+
indicatif_log_bridge::LogWrapper::new(PROCESS_BARS.clone(), logger)
30+
.try_init()
31+
.unwrap();
32+
log::set_max_level(level);
2533
}
2634
}
2735

0 commit comments

Comments
 (0)