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:
parent
4528e2f1ea
commit
4ea40b4bea
1 changed files with 1 additions and 1 deletions
|
|
@ -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),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue