X Tutup
Skip to content

Commit 6765524

Browse files
committed
use write lock when updating container stats
Signed-off-by: Michael Crosby <michael@thepasture.io>
1 parent 195def1 commit 6765524

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pkg/cri/store/container/container.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,8 @@ func (s *Store) List() []Container {
170170
}
171171

172172
func (s *Store) UpdateContainerStats(id string, newContainerStats *stats.ContainerStats) error {
173-
s.lock.RLock()
174-
defer s.lock.RUnlock()
173+
s.lock.Lock()
174+
defer s.lock.Unlock()
175175
id, err := s.idIndex.Get(id)
176176
if err != nil {
177177
if err == truncindex.ErrNotExist {

0 commit comments

Comments
 (0)
X Tutup