rate_limiter: Use Mutex::get_mut() in update_buckets

There is no need to lock. That function already holds a mutable
reference to self.

Signed-off-by: Wei Liu <liuwe@microsoft.com>
This commit is contained in:
Wei Liu 2025-07-17 16:59:06 +00:00 committed by Wei Liu
parent 4528e2f1ea
commit 4ea40b4bea

View file

@ -486,7 +486,7 @@ impl RateLimiter {
/// Updates the parameters of the token buckets associated with this RateLimiter.
// TODO: Please note that, right now, the buckets become full after being updated.
pub fn update_buckets(&mut self, bytes: BucketUpdate, ops: BucketUpdate) {
let mut guard = self.inner.lock().unwrap();
let guard = self.inner.get_mut().unwrap();
match bytes {
BucketUpdate::Disabled => guard.bandwidth = None,
BucketUpdate::Update(tb) => guard.bandwidth = Some(tb),