diff --git a/proxy/src/lib.rs b/proxy/src/lib.rs index 78f0c350a9..e304cfa2b9 100644 --- a/proxy/src/lib.rs +++ b/proxy/src/lib.rs @@ -157,12 +157,10 @@ smol_str_wrapper!(BranchId); // 90% of project strings are 23 characters or less. smol_str_wrapper!(ProjectId); -// ket value neon_option fields -smol_str_wrapper!(EndpointCacheKeyExtra); #[derive(PartialEq, Eq, Hash, Debug, Clone)] pub struct EndpointCacheKey { pub id: EndpointIdInt, - pub extra: EndpointCacheKeyExtra, + pub extra: Box, } impl std::fmt::Display for EndpointCacheKey { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { diff --git a/proxy/src/proxy.rs b/proxy/src/proxy.rs index 84a0aae652..76f84975ad 100644 --- a/proxy/src/proxy.rs +++ b/proxy/src/proxy.rs @@ -11,7 +11,6 @@ pub use copy_bidirectional::copy_bidirectional_client_compute; pub use copy_bidirectional::ErrorSource; use crate::intern::EndpointIdInt; -use crate::EndpointCacheKeyExtra; use crate::{ auth, cancellation::{self, CancellationHandlerMain, CancellationHandlerMainInternal}, @@ -413,14 +412,13 @@ impl NeonOptions { } } - pub fn get_cache_key_extras(&self) -> EndpointCacheKeyExtra { - // prefix + format!(" {k}:{v}") - // kinda jank because SmolStr is immutable - self.0 - .iter() - .flat_map(|(k, v)| [" ", &**k, ":", &**v]) - .collect::() - .into() + pub fn get_cache_key_extras(&self) -> Box { + let mut extras = String::new(); + for (k, v) in &self.0 { + use std::fmt::Write; + write!(&mut extras, " {k}:{v}").unwrap(); + } + extras.into_boxed_str() } /// DeepObject format