From c9422759aafbb776815e8f65ba449e67e976f9ca Mon Sep 17 00:00:00 2001 From: Ara Sadoyan Date: Tue, 17 Mar 2026 13:54:42 +0100 Subject: [PATCH] Minor performance improvement --- src/web/proxyhttp.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/web/proxyhttp.rs b/src/web/proxyhttp.rs index 10f39d6..a930b1e 100644 --- a/src/web/proxyhttp.rs +++ b/src/web/proxyhttp.rs @@ -247,17 +247,17 @@ impl ProxyHttp for LB { } async fn response_filter(&self, session: &mut Session, _upstream_response: &mut ResponseHeader, ctx: &mut Self::CTX) -> Result<()> { if ctx.sticky_sessions { - if let Some(bid) = ctx.backend_id.clone() { - if REVERSE_STORE.get(&*bid).is_none() { + if let Some(bid) = &ctx.backend_id { + if REVERSE_STORE.get(bid).is_none() { let mut hasher = Sha256::new(); - hasher.update(bid.clone().into_bytes()); + hasher.update(bid.as_bytes()); let hash = hasher.finalize(); let hex_hash = base16ct::lower::encode_string(&hash); let hh = hex_hash[0..50].to_string(); REVERSE_STORE.insert(bid.clone(), hh.clone()); - REVERSE_STORE.insert(hh.clone(), bid.clone()); + REVERSE_STORE.insert(hh, bid.clone()); } - if let Some(tt) = REVERSE_STORE.get(&*bid) { + if let Some(tt) = REVERSE_STORE.get(bid) { let _ = _upstream_response.insert_header("set-cookie", format!("backend_id={}; Path=/; Max-Age=600; HttpOnly; SameSite=Lax", tt.value())); } }