autorun 타이밍 변경. Query를 먼저 보내고 해야 함

This commit is contained in:
2024-06-05 15:33:09 +09:00
parent d546f2340d
commit 4e928f3426

View File

@ -327,32 +327,6 @@ func NewClient(standalone bool) (HoustonClient, error) {
case newClient := <-hc.clientChan:
op = protos.NewOperationClient(newClient)
if autorun != nil && len(*autorun) > 0 {
hascount := strings.Split(*autorun, "/")
var service string
count := 1
if len(hascount) > 1 {
service = hascount[0]
count, _ = strconv.Atoi(hascount[1])
} else {
service = *autorun
}
if cmd, ok := hc.config.Autorun[service]; ok {
// service 서비스
for i := 0; i < count; i++ {
sr := shared.StartProcessRequest{
Name: service,
Version: cmd.Version,
Args: append([]string{cmd.Exec}, cmd.Args...),
}
if err := hc.startChildProcess(&sr, op); err != nil {
logger.Println("startChildProcess failed by autorun :", err)
}
}
}
}
case exited := <-exitChan:
var newprocs []*procmeta
@ -616,6 +590,35 @@ func (hc *houstonClient) checkOperation(client *grpc.ClientConn) error {
return err
}
if autorun != nil && len(*autorun) > 0 {
hascount := strings.Split(*autorun, "/")
var service string
count := 1
if len(hascount) > 1 {
service = hascount[0]
count, _ = strconv.Atoi(hascount[1])
} else {
service = *autorun
}
if cmd, ok := hc.config.Autorun[service]; ok {
// service 서비스
for i := 0; i < count; i++ {
sr := shared.StartProcessRequest{
Name: service,
Version: cmd.Version,
Args: append([]string{cmd.Exec}, cmd.Args...),
}
if err := hc.startChildProcess(&sr, op); err != nil {
logger.Println("startChildProcess failed by autorun :", err)
} else {
logger.Println("autorun success :", sr)
}
}
}
}
for {
update, err := cl.Recv()
if err != nil {