@@ -380,24 +380,28 @@ func (m *manager) removeStaleState() {
380
380
assignments := m .state .GetCPUAssignments ()
381
381
for podUID := range assignments {
382
382
for containerName := range assignments [podUID ] {
383
- if _ , ok := activeContainers [podUID ][containerName ]; ! ok {
384
- klog .V (2 ).InfoS ("RemoveStaleState: removing container" , "podUID" , podUID , "containerName" , containerName )
385
- err := m .policyRemoveContainerByRef (podUID , containerName )
386
- if err != nil {
387
- klog .ErrorS (err , "RemoveStaleState: failed to remove container" , "podUID" , podUID , "containerName" , containerName )
388
- }
383
+ if _ , ok := activeContainers [podUID ][containerName ]; ok {
384
+ klog .V (4 ).InfoS ("RemoveStaleState: container still active" , "podUID" , podUID , "containerName" , containerName )
385
+ continue
389
386
}
390
- }
391
- }
392
-
393
- m .containerMap .Visit (func (podUID , containerName , containerID string ) {
394
- if _ , ok := activeContainers [podUID ][containerName ]; ! ok {
395
387
klog .V (2 ).InfoS ("RemoveStaleState: removing container" , "podUID" , podUID , "containerName" , containerName )
396
388
err := m .policyRemoveContainerByRef (podUID , containerName )
397
389
if err != nil {
398
390
klog .ErrorS (err , "RemoveStaleState: failed to remove container" , "podUID" , podUID , "containerName" , containerName )
399
391
}
400
392
}
393
+ }
394
+
395
+ m .containerMap .Visit (func (podUID , containerName , containerID string ) {
396
+ if _ , ok := activeContainers [podUID ][containerName ]; ok {
397
+ klog .V (4 ).InfoS ("RemoveStaleState: containerMap: container still active" , "podUID" , podUID , "containerName" , containerName )
398
+ return
399
+ }
400
+ klog .V (2 ).InfoS ("RemoveStaleState: containerMap: removing container" , "podUID" , podUID , "containerName" , containerName )
401
+ err := m .policyRemoveContainerByRef (podUID , containerName )
402
+ if err != nil {
403
+ klog .ErrorS (err , "RemoveStaleState: containerMap: failed to remove container" , "podUID" , podUID , "containerName" , containerName )
404
+ }
401
405
})
402
406
}
403
407
0 commit comments