Acquire instance read lock once
This commit is contained in:
parent
db3a9ae7fb
commit
c17451ca73
|
@ -2490,11 +2490,12 @@ impl ClusterInfo {
|
||||||
.collect()
|
.collect()
|
||||||
})
|
})
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if there is a duplicate instance of
|
// Check if there is a duplicate instance of
|
||||||
// this node with more recent timestamp.
|
// this node with more recent timestamp.
|
||||||
|
let instance = self.instance.read().unwrap();
|
||||||
let check_duplicate_instance = |values: &[CrdsValue]| {
|
let check_duplicate_instance = |values: &[CrdsValue]| {
|
||||||
if should_check_duplicate_instance {
|
if should_check_duplicate_instance {
|
||||||
let instance = self.instance.read().unwrap();
|
|
||||||
for value in values {
|
for value in values {
|
||||||
if instance.check_duplicate(value) {
|
if instance.check_duplicate(value) {
|
||||||
return Err(GossipError::DuplicateNodeInstance);
|
return Err(GossipError::DuplicateNodeInstance);
|
||||||
|
|
Loading…
Reference in New Issue