Skip to content

Commit

Permalink
chore: address CR
Browse files Browse the repository at this point in the history
  • Loading branch information
ShiKaiWi committed Oct 10, 2023
1 parent f719cd3 commit f81162b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cluster/src/shard_lock_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -436,14 +436,15 @@ impl ShardLock {
);
return Ok(None);
}
let lease_id = resp.kvs()[0].lease();
let kv = &resp.kvs()[0];
let lease_id = kv.lease();
if lease_id == 0 {
// There is no lease attached to the lock key.
return Ok(None);
}

// FIXME: A better way is to compare the specific field of the decoded values.
if resp.kvs()[0].value() != self.value {
if kv.value() != self.value {
warn!(
"Try to acquire a lock held by others, shard_id:{}",
self.shard_id
Expand Down

0 comments on commit f81162b

Please sign in to comment.