From 4cb0bd4ace588d962f1c8c201e2b2e24f158a3a0 Mon Sep 17 00:00:00 2001 From: yjhmelody Date: Mon, 24 Jun 2024 17:46:14 +0800 Subject: [PATCH] fix --- src/extensions/rate_limit/mod.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/extensions/rate_limit/mod.rs b/src/extensions/rate_limit/mod.rs index 7d24404..dc76806 100644 --- a/src/extensions/rate_limit/mod.rs +++ b/src/extensions/rate_limit/mod.rs @@ -99,7 +99,7 @@ impl RateLimitBuilder { let quota = build_quota(burst, period); let limiter = RateLimiter::direct(quota); - for (method, weight) in &method_weights.0 { + for (method, weight) in method_weights.0.as_ref() { if let Some(n) = NonZeroU32::new(*weight) { if limiter.check_n(n).is_err() { bail!("`{method}` weight config too big for connection rate limit: {}", n); @@ -118,7 +118,7 @@ impl RateLimitBuilder { let quota = build_quota(burst, period); let limiter = RateLimiter::direct(quota); - for (method, weight) in &method_weights.0 { + for (method, weight) in method_weights.0.as_ref() { if let Some(n) = NonZeroU32::new(*weight) { if limiter.check_n(n).is_err() { bail!("`{method}` weight config too big for ip rate limit: {}", n);