자동 재접속

This commit is contained in:
2023-06-14 01:50:40 +09:00
parent 2e4b7811db
commit 96ee2a4627
3 changed files with 43 additions and 38 deletions

View File

@ -53,7 +53,7 @@ func (hc *houstonClient) uploadZipLogFile(zipFile string, name string, version s
defer zf.Close()
req, err := http.NewRequest("POST", hc.httpAddr+"/upload", zf)
req, err := http.NewRequest("POST", hc.config.HttpAddress+"/upload", zf)
if err != nil {
logger.Println(err)
}
@ -323,7 +323,7 @@ func (hc *houstonClient) launch(meta *procmeta) error {
var errPrepareprocessLaunchFailed = errors.New("prepareProcessLaunch failed")
func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) error {
func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest, op protos.OperationClient) error {
logger.Println("startChildProcess :", *req)
if req.Version == "latest" {
// 최신 버전을 찾음
@ -363,8 +363,6 @@ func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) erro
}
hc.childProcs = append(hc.childProcs, meta)
op := protos.NewOperationClient(hc.client)
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
return nil
@ -372,7 +370,7 @@ func (hc *houstonClient) startChildProcess(req *shared.StartProcessRequest) erro
var errNoRunningProcess = errors.New("no running processed")
func (hc *houstonClient) stopChildProcess(req *shared.StopProcessRequest) error {
func (hc *houstonClient) stopChildProcess(req *shared.StopProcessRequest, op protos.OperationClient) error {
if req.Version == "latest" {
// 최신 버전을 찾음
latest, err := shared.FindLastestVersion(req.Name)
@ -422,7 +420,6 @@ func (hc *houstonClient) stopChildProcess(req *shared.StopProcessRequest) error
}
}
op := protos.NewOperationClient(hc.client)
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
for _, proc := range killing {
@ -439,7 +436,7 @@ func (hc *houstonClient) stopChildProcess(req *shared.StopProcessRequest) error
return errNoRunningProcess
}
func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest) error {
func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest, op protos.OperationClient) error {
if req.Version == "latest" {
// 최신 버전을 찾음
latest, err := shared.FindLastestVersion(req.Name)
@ -472,7 +469,6 @@ func (hc *houstonClient) restartChildProcess(req *shared.RestartProcessRequest)
proc.state = protos.ProcessState_Stopping
}
op := protos.NewOperationClient(hc.client)
op.Refresh(context.Background(), hc.makeOperationQueryRequest())
for _, proc := range restarts {