update condition

This commit is contained in:
Alex Auvolat 2021-03-05 17:08:03 +01:00
parent 5e33c3cfc9
commit 7cda917b6b

View file

@ -122,9 +122,8 @@ impl Ring {
.iter()
.map(|(_id, info)| info.datacenter.as_str())
.collect::<HashSet<&str>>();
if !partitions[qv]
.iter()
.any(|(_id, i)| *i.datacenter == node_info.datacenter)
if (p_dcs.len() < n_datacenters
&& !p_dcs.contains(&node_info.datacenter.as_str()))
|| (p_dcs.len() == n_datacenters
&& !partitions[qv].iter().any(|(id, _i)| id == node_id))
{