Merge pull request #8130 from danlenar/main
Fix concurrent writes for UpdateContainerStats
This commit is contained in:
commit
887395aa12
@ -129,8 +129,8 @@ func (s *Store) List() []Sandbox {
|
|||||||
// stats present in 'newContainerStats'. Returns errdefs.ErrNotFound
|
// stats present in 'newContainerStats'. Returns errdefs.ErrNotFound
|
||||||
// if the sandbox does not exist in the store.
|
// if the sandbox does not exist in the store.
|
||||||
func (s *Store) UpdateContainerStats(id string, newContainerStats *stats.ContainerStats) error {
|
func (s *Store) UpdateContainerStats(id string, newContainerStats *stats.ContainerStats) error {
|
||||||
s.lock.RLock()
|
s.lock.Lock()
|
||||||
defer s.lock.RUnlock()
|
defer s.lock.Unlock()
|
||||||
id, err := s.idIndex.Get(id)
|
id, err := s.idIndex.Get(id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == truncindex.ErrNotExist {
|
if err == truncindex.ErrNotExist {
|
||||||
|
Loading…
Reference in New Issue
Block a user