Skip to content

Commit

Permalink
Fix concurrent writes for UpdateContainerStats
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Lenar <dlenar@vailsys.com>
(cherry picked from commit a48dbef)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
danlenar authored and thaJeztah committed Jul 14, 2023
1 parent 3787ef4 commit 9f65014
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/cri/store/sandbox/sandbox.go
Expand Up @@ -125,8 +125,8 @@ func (s *Store) List() []Sandbox {
}

func (s *Store) UpdateContainerStats(id string, newContainerStats *stats.ContainerStats) error {
s.lock.RLock()
defer s.lock.RUnlock()
s.lock.Lock()
defer s.lock.Unlock()
id, err := s.idIndex.Get(id)
if err != nil {
if err == truncindex.ErrNotExist {
Expand Down

0 comments on commit 9f65014

Please sign in to comment.