From e0968dcce3d9b1ea18922120f7e2c1b06206ac72 Mon Sep 17 00:00:00 2001 From: asonix Date: Sun, 24 Sep 2023 15:22:30 -0500 Subject: [PATCH] Remove serde-cbor, num_cpus --- Cargo.lock | 18 ------------------ Cargo.toml | 2 -- src/lib.rs | 6 +++++- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a9f367..4741660 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1034,12 +1034,6 @@ dependencies = [ "tracing", ] -[[package]] -name = "half" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabb4a44450da02c90444cf74558da904edde8fb4e9035a9a6a4e15445af0bd7" - [[package]] name = "hashbrown" version = "0.12.3" @@ -1833,7 +1827,6 @@ dependencies = [ "metrics", "metrics-exporter-prometheus", "mime", - "num_cpus", "once_cell", "opentelemetry", "opentelemetry-otlp", @@ -1846,7 +1839,6 @@ dependencies = [ "rusty-s3", "serde", "serde-tuple-vec-map", - "serde_cbor", "serde_json", "serde_urlencoded", "sha2", @@ -2460,16 +2452,6 @@ dependencies = [ "serde", ] -[[package]] -name = "serde_cbor" -version = "0.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bef2ebfde456fb76bbcf9f59315333decc4fda0b2b44b420243c11e0f5ec1f5" -dependencies = [ - "half", - "serde", -] - [[package]] name = "serde_derive" version = "1.0.188" diff --git a/Cargo.toml b/Cargo.toml index 753b468..bea4346 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,6 @@ md-5 = "0.10.5" metrics = "0.21.1" metrics-exporter-prometheus = { version = "0.12.1", default-features = false, features = ["http-listener"] } mime = "0.3.1" -num_cpus = "1.13" once_cell = "1.4.0" opentelemetry = { version = "0.20", features = ["rt-tokio"] } opentelemetry-otlp = "0.13" @@ -51,7 +50,6 @@ reqwest-tracing = { version = "0.4.5" } rusty-s3 = "0.4.1" serde = { version = "1.0", features = ["derive"] } serde-tuple-vec-map = "1.0.1" -serde_cbor = "0.11.2" serde_json = "1.0" serde_urlencoded = "0.7.1" sha2 = "0.10.0" diff --git a/src/lib.rs b/src/lib.rs index 2d47af1..c121177 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -89,7 +89,11 @@ const DAYS: u32 = 24 * HOURS; const NOT_FOUND_KEY: &str = "404-alias"; static PROCESS_SEMAPHORE: Lazy = Lazy::new(|| { - let permits = num_cpus::get().saturating_sub(1).max(1); + let permits = std::thread::available_parallelism() + .map(usize::from) + .unwrap_or(1) + .saturating_sub(1) + .max(1); crate::sync::bare_semaphore(permits) });