Skip to content

Commit

Permalink
Acquire instance read lock once
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Jul 2, 2021
1 parent db3a9ae commit c17451c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion gossip/src/cluster_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2490,11 +2490,12 @@ impl ClusterInfo {
.collect()
})
};

// Check if there is a duplicate instance of
// this node with more recent timestamp.
let instance = self.instance.read().unwrap();
let check_duplicate_instance = |values: &[CrdsValue]| {
if should_check_duplicate_instance {
let instance = self.instance.read().unwrap();
for value in values {
if instance.check_duplicate(value) {
return Err(GossipError::DuplicateNodeInstance);
Expand Down

0 comments on commit c17451c

Please sign in to comment.