Revert "Hold mutex lock shorter when processing inter-pod affinity/anti-affin…"

This commit is contained in:
Babak "Bobby" Salamat 2018-11-08 18:26:26 -08:00 committed by GitHub
parent 34be549935
commit a2c0958428
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -92,13 +92,15 @@ func (p *podAffinityPriorityMap) processTerm(term *v1.PodAffinityTerm, podDefini
} }
match := priorityutil.PodMatchesTermsNamespaceAndSelector(podToCheck, namespaces, selector) match := priorityutil.PodMatchesTermsNamespaceAndSelector(podToCheck, namespaces, selector)
if match { if match {
func() {
p.Lock()
defer p.Unlock()
for _, node := range p.nodes { for _, node := range p.nodes {
if priorityutil.NodesHaveSameTopologyKey(node, fixedNode, term.TopologyKey) { if priorityutil.NodesHaveSameTopologyKey(node, fixedNode, term.TopologyKey) {
p.Lock()
p.counts[node.Name] += weight p.counts[node.Name] += weight
p.Unlock()
} }
} }
}()
} }
} }