Fix concurrent writes for UpdateContainerStats
Signed-off-by: Daniel Lenar <dlenar@vailsys.com>
This commit is contained in:
parent
dc03a4baa2
commit
a48dbefc15
@ -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