Skip to content

Commit

Permalink
koordlet: fix by adding lock during podmap update (#1838)
Browse files Browse the repository at this point in the history
Signed-off-by: xujihui1985 <[email protected]>
  • Loading branch information
xujihui1985 committed Jan 15, 2024
1 parent acb6926 commit c70f410
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/koordlet/statesinformer/impl/states_pods.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,10 @@ func (s *podsInformer) syncPods() error {
// record pod container metrics
recordPodResourceMetrics(podMeta)
}
s.podRWMutex.Lock()
s.podMap = newPodMap
s.podRWMutex.Unlock()

s.podHasSynced.Store(true)
s.podUpdatedTime = time.Now()
klog.V(4).Infof("get pods success, len %d, time %s", len(s.podMap), s.podUpdatedTime.String())
Expand Down

0 comments on commit c70f410

Please sign in to comment.