Unverified Commit 774b1849 authored by k8s-ci-robot's avatar k8s-ci-robot Committed by GitHub

Merge pull request #70605 from bsalamat/affinity_lock_opt

Hold mutex lock shorter when processing inter-pod affinity/anti-affin…
parents 5fdad5c1 aa8b5b43
......@@ -92,15 +92,13 @@ func (p *podAffinityPriorityMap) processTerm(term *v1.PodAffinityTerm, podDefini
}
match := priorityutil.PodMatchesTermsNamespaceAndSelector(podToCheck, namespaces, selector)
if match {
func() {
p.Lock()
defer p.Unlock()
for _, node := range p.nodes {
if priorityutil.NodesHaveSameTopologyKey(node, fixedNode, term.TopologyKey) {
p.Lock()
p.counts[node.Name] += weight
p.Unlock()
}
}
}()
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment