ing
This commit is contained in:
parent
e6889911bb
commit
eecc41f19b
|
@ -141,13 +141,13 @@ func (s *ContainerService) runContainer(containerType occp.ContainerType) (*cont
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
go func(containerType occp.ContainerType, cmd *exec.Cmd) {
|
// go func(containerType occp.ContainerType, cmd *exec.Cmd) {
|
||||||
if err := cmd.Wait(); nil != err {
|
// if err := cmd.Wait(); nil != err {
|
||||||
logging.Logger().Error(err)
|
// logging.Logger().Error(err)
|
||||||
}
|
// }
|
||||||
logging.Logger().Infof("Container[%s] has been stopped", containerType.String())
|
// logging.Logger().Infof("Container[%s] has been stopped", containerType.String())
|
||||||
s.refreshContainer(containerType)
|
// s.refreshContainer(containerType)
|
||||||
}(containerType, cmd)
|
// }(containerType, cmd)
|
||||||
|
|
||||||
cs := &containerState{
|
cs := &containerState{
|
||||||
containerType: containerType,
|
containerType: containerType,
|
||||||
|
@ -173,6 +173,7 @@ func (s *ContainerService) refreshContainer(containerType occp.ContainerType) {
|
||||||
logging.Logger().Error(err)
|
logging.Logger().Error(err)
|
||||||
}
|
}
|
||||||
cs.client = nil
|
cs.client = nil
|
||||||
|
delete(s.containerStates, containerType)
|
||||||
if _, err := s.getClient(containerType); nil != err {
|
if _, err := s.getClient(containerType); nil != err {
|
||||||
logging.Logger().Error(err)
|
logging.Logger().Error(err)
|
||||||
}
|
}
|
||||||
|
@ -238,15 +239,15 @@ func (s *ContainerService) checkContainer(containerType occp.ContainerType) *con
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
p, err := os.FindProcess(cs.cmd.Process.Pid)
|
// p, err := os.FindProcess(cs.cmd.Process.Pid)
|
||||||
if nil != err {
|
// if nil != err {
|
||||||
s.removeContainerState(containerType)
|
// s.removeContainerState(containerType)
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
if nil == p {
|
// if nil == p {
|
||||||
s.removeContainerState(containerType)
|
// s.removeContainerState(containerType)
|
||||||
return nil
|
// return nil
|
||||||
}
|
// }
|
||||||
|
|
||||||
// if nil != cs.cmd.ProcessState && cs.cmd.ProcessState.Exited() {
|
// if nil != cs.cmd.ProcessState && cs.cmd.ProcessState.Exited() {
|
||||||
// s.removeContainerState(containerType)
|
// s.removeContainerState(containerType)
|
||||||
|
@ -276,8 +277,10 @@ func (s *ContainerService) removeContainerState(containerType occp.ContainerType
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if nil != cs.client {
|
||||||
delete(s.connectorMap, cs.client.Connector)
|
delete(s.connectorMap, cs.client.Connector)
|
||||||
cs.client.Stop(context.Background())
|
cs.client.Stop(context.Background())
|
||||||
|
}
|
||||||
s.killContainer(containerType)
|
s.killContainer(containerType)
|
||||||
delete(s.containerStates, containerType)
|
delete(s.containerStates, containerType)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user