Merge pull request #409 from sameo/topic/fat-lock
Serialize Update and Sandbox/Container creation operations
This commit is contained in:
commit
3c7f3ab2ec
3 changed files with 22 additions and 12 deletions
|
@ -35,6 +35,7 @@ type Server struct {
|
|||
images storage.ImageServer
|
||||
storage storage.RuntimeServer
|
||||
stateLock sync.Mutex
|
||||
updateLock sync.RWMutex
|
||||
state *serverState
|
||||
netPlugin ocicni.CNIPlugin
|
||||
podNameIndex *registrar.Registrar
|
||||
|
@ -288,6 +289,9 @@ func (s *Server) Update() {
|
|||
}
|
||||
|
||||
func (s *Server) update() error {
|
||||
s.updateLock.Lock()
|
||||
defer s.updateLock.Unlock()
|
||||
|
||||
containers, err := s.store.Containers()
|
||||
if err != nil && !os.IsNotExist(err) {
|
||||
logrus.Warnf("could not read containers and sandboxes: %v", err)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue