mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-09 20:17:41 +00:00
Reduce unnecessary Set in updateAllocatedDevices
This commit is contained in:
parent
7c87b5fb55
commit
86f3bc25e1
@ -602,12 +602,10 @@ func (m *ManagerImpl) updateAllocatedDevices(activePods []*v1.Pod) {
|
|||||||
}
|
}
|
||||||
m.mutex.Lock()
|
m.mutex.Lock()
|
||||||
defer m.mutex.Unlock()
|
defer m.mutex.Unlock()
|
||||||
activePodUids := sets.NewString()
|
podsToBeRemoved := m.podDevices.pods()
|
||||||
for _, pod := range activePods {
|
for _, pod := range activePods {
|
||||||
activePodUids.Insert(string(pod.UID))
|
podsToBeRemoved.Delete(string(pod.UID))
|
||||||
}
|
}
|
||||||
allocatedPodUids := m.podDevices.pods()
|
|
||||||
podsToBeRemoved := allocatedPodUids.Difference(activePodUids)
|
|
||||||
if len(podsToBeRemoved) <= 0 {
|
if len(podsToBeRemoved) <= 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user