container: Reduce number of calls to UpdateStatus
Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
This commit is contained in:
parent
3f1b42ee9e
commit
ea4b6fa55d
3 changed files with 0 additions and 11 deletions
|
@ -334,10 +334,6 @@ func (s *Server) CreateContainer(ctx context.Context, req *pb.CreateContainerReq
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err = s.Runtime().UpdateStatus(container); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
s.addContainer(container)
|
s.addContainer(container)
|
||||||
|
|
||||||
if err = s.CtrIDIndex().Add(containerID); err != nil {
|
if err = s.CtrIDIndex().Add(containerID); err != nil {
|
||||||
|
|
|
@ -20,10 +20,6 @@ func (s *Server) RemoveContainer(ctx context.Context, req *pb.RemoveContainerReq
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.Runtime().UpdateStatus(c); err != nil {
|
|
||||||
return nil, fmt.Errorf("failed to update container state: %v", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
cState := s.Runtime().ContainerStatus(c)
|
cState := s.Runtime().ContainerStatus(c)
|
||||||
if cState.Status == oci.ContainerStateCreated || cState.Status == oci.ContainerStateRunning {
|
if cState.Status == oci.ContainerStateCreated || cState.Status == oci.ContainerStateRunning {
|
||||||
if err := s.Runtime().StopContainer(c, -1); err != nil {
|
if err := s.Runtime().StopContainer(c, -1); err != nil {
|
||||||
|
|
|
@ -17,9 +17,6 @@ func (s *Server) StopContainer(ctx context.Context, req *pb.StopContainerRequest
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := s.Runtime().UpdateStatus(c); err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
cStatus := s.Runtime().ContainerStatus(c)
|
cStatus := s.Runtime().ContainerStatus(c)
|
||||||
if cStatus.Status != oci.ContainerStateStopped {
|
if cStatus.Status != oci.ContainerStateStopped {
|
||||||
if err := s.Runtime().StopContainer(c, req.Timeout); err != nil {
|
if err := s.Runtime().StopContainer(c, req.Timeout); err != nil {
|
||||||
|
|
Loading…
Reference in a new issue