From 24b243cfb4a0314cdae6da88f744ab17f819a454 Mon Sep 17 00:00:00 2001 From: Oscar Boykin Date: Wed, 7 Feb 2024 08:16:05 -1000 Subject: [PATCH 1/2] Bump system to 0.30.5 --- Cargo.lock | 35 ++++++++++++++----- bzl-remote-core/Cargo.toml | 2 +- .../src/cache_service/http_endpoint.rs | 10 +++--- 3 files changed, 31 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8362f17a8..67f1868a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2522,9 +2522,9 @@ dependencies = [ [[package]] name = "rayon" -version = "1.6.1" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6db3a213adf02b3bcfd2d3846bb41cb22857d131789e01df434fb7e7bc0759b7" +checksum = "fa7237101a77a10773db45d62004a272517633fbcc3df19d96455ede1122e051" dependencies = [ "either", "rayon-core", @@ -2532,14 +2532,12 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.10.2" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "356a0625f1954f730c0201cdab48611198dc6ce21f4acff55089b5a78e6e835b" +checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" dependencies = [ - "crossbeam-channel", "crossbeam-deque", "crossbeam-utils", - "num_cpus", ] [[package]] @@ -3037,9 +3035,9 @@ checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" [[package]] name = "sysinfo" -version = "0.29.11" +version = "0.30.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd727fc423c2060f6c92d9534cef765c65a6ed3f428a03d7def74a8c4348e666" +checksum = "1fb4f3438c8f6389c864e61221cbc97e9bca98b4daf39a5beb7bea660f528bb2" dependencies = [ "cfg-if", "core-foundation-sys", @@ -3047,7 +3045,7 @@ dependencies = [ "ntapi", "once_cell", "rayon", - "winapi", + "windows", ] [[package]] @@ -3711,6 +3709,25 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" +dependencies = [ + "windows-core", + "windows-targets 0.52.0", +] + +[[package]] +name = "windows-core" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" +dependencies = [ + "windows-targets 0.52.0", +] + [[package]] name = "windows-sys" version = "0.42.0" diff --git a/bzl-remote-core/Cargo.toml b/bzl-remote-core/Cargo.toml index 7c8a6a299..565c90a10 100644 --- a/bzl-remote-core/Cargo.toml +++ b/bzl-remote-core/Cargo.toml @@ -59,7 +59,7 @@ redis = { version = "0.24.0", features = ["tokio-comp", "connection-manager"] } urlencoding = "2.1.3" http = "0.2.11" http-body = "0.4.5" -sysinfo = "0.29.11" +sysinfo = "0.30.5" [build-dependencies] diff --git a/bzl-remote-core/src/cache_service/http_endpoint.rs b/bzl-remote-core/src/cache_service/http_endpoint.rs index 18b0fe319..5c49c9afa 100644 --- a/bzl-remote-core/src/cache_service/http_endpoint.rs +++ b/bzl-remote-core/src/cache_service/http_endpoint.rs @@ -14,12 +14,10 @@ use http::Uri; use hyper::{Body, Request, Response, StatusCode}; use prost::Message; use sha2::Digest; -use sysinfo::System; +use sysinfo::Disks; // Import the multer types. use tempfile::NamedTempFile; -use sysinfo::DiskExt; -use sysinfo::SystemExt; use tokio::io::AsyncWriteExt; use tokio::sync::Mutex; @@ -69,7 +67,6 @@ pub enum HttpEndpointError { #[derive(Debug)] struct HealthStatus { - system: System, last_update: Instant, last_status_code: StatusCode, last_description: String, @@ -78,7 +75,6 @@ struct HealthStatus { impl Default for HealthStatus { fn default() -> Self { Self { - system: System::new_all(), last_update: Instant::now(), last_status_code: StatusCode::OK, last_description: String::from("HEALTHY"), @@ -92,7 +88,9 @@ impl HealthStatus { self.last_update = now; self.last_description = String::from("OK -- unable to find disk space"); self.last_status_code = StatusCode::OK; - for disk in (&mut self.system).disks_mut() { + let mut disks = Disks::new_with_refreshed_list(); + for disk in disks.list_mut() { + //(&mut self.system).disks_mut() { if disk.mount_point() == PathBuf::from("/") { disk.refresh(); let available_space = disk.available_space() as f64 / disk.total_space() as f64; From 278400dda11fbe236f371357557a828500238244 Mon Sep 17 00:00:00 2001 From: Oscar Boykin Date: Wed, 7 Feb 2024 08:29:59 -1000 Subject: [PATCH 2/2] remove commented code --- bzl-remote-core/src/cache_service/http_endpoint.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/bzl-remote-core/src/cache_service/http_endpoint.rs b/bzl-remote-core/src/cache_service/http_endpoint.rs index 5c49c9afa..2f60c8ce3 100644 --- a/bzl-remote-core/src/cache_service/http_endpoint.rs +++ b/bzl-remote-core/src/cache_service/http_endpoint.rs @@ -90,7 +90,6 @@ impl HealthStatus { self.last_status_code = StatusCode::OK; let mut disks = Disks::new_with_refreshed_list(); for disk in disks.list_mut() { - //(&mut self.system).disks_mut() { if disk.mount_point() == PathBuf::from("/") { disk.refresh(); let available_space = disk.available_space() as f64 / disk.total_space() as f64;