hosuton 종료 안되는 문제 수정
This commit is contained in:
@ -336,6 +336,7 @@ func NewClient(standalone bool) (HoustonClient, error) {
|
|||||||
exitChan := make(chan *exec.Cmd, 10)
|
exitChan := make(chan *exec.Cmd, 10)
|
||||||
operationChan := make(chan *protos.OperationQueryResponse, 10)
|
operationChan := make(chan *protos.OperationQueryResponse, 10)
|
||||||
hc.wg.Add(1)
|
hc.wg.Add(1)
|
||||||
|
ignoreRecover := int32(0)
|
||||||
|
|
||||||
// autorun 처리
|
// autorun 처리
|
||||||
go func() {
|
go func() {
|
||||||
@ -510,7 +511,7 @@ func NewClient(standalone bool) (HoustonClient, error) {
|
|||||||
found.cmd.Wait()
|
found.cmd.Wait()
|
||||||
found.cmd.Process.Release()
|
found.cmd.Process.Release()
|
||||||
|
|
||||||
if found.recover {
|
if found.recover && atomic.LoadInt32(&ignoreRecover) == 0 {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
sr := shared.StartProcessRequest{
|
sr := shared.StartProcessRequest{
|
||||||
Name: found.name,
|
Name: found.name,
|
||||||
@ -539,6 +540,8 @@ func NewClient(standalone bool) (HoustonClient, error) {
|
|||||||
|
|
||||||
hc.shutdownFunc = func() {
|
hc.shutdownFunc = func() {
|
||||||
// child process 강제 종료
|
// child process 강제 종료
|
||||||
|
atomic.StoreInt32(&ignoreRecover, 1)
|
||||||
|
|
||||||
for _, procmeta := range hc.childProcs {
|
for _, procmeta := range hc.childProcs {
|
||||||
if procmeta.cmd != nil && procmeta.cmd.Process != nil {
|
if procmeta.cmd != nil && procmeta.cmd.Process != nil {
|
||||||
procmeta.cmd.Process.Signal(os.Kill)
|
procmeta.cmd.Process.Signal(os.Kill)
|
||||||
@ -633,6 +636,7 @@ func (hc *houstonClient) Start() {
|
|||||||
// upload 고루틴
|
// upload 고루틴
|
||||||
url := hc.config.HttpAddress + "/upload"
|
url := hc.config.HttpAddress + "/upload"
|
||||||
for req := range hc.uploadChan {
|
for req := range hc.uploadChan {
|
||||||
|
logger.Println("uploadSafe :", req)
|
||||||
err := uploadSafe(url, req.logFile, req.name, req.version)
|
err := uploadSafe(url, req.logFile, req.name, req.version)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Println("uploadSafe return err :", err)
|
logger.Println("uploadSafe return err :", err)
|
||||||
|
|||||||
@ -141,7 +141,6 @@ func (h *houstonHandler) RegisterHandlers(serveMux gocommon.ServerMuxInterface,
|
|||||||
filepath := path.Join(dir, filename)
|
filepath := path.Join(dir, filename)
|
||||||
// filepath가 이미 있으면 append
|
// filepath가 이미 있으면 append
|
||||||
localfile, _ := os.OpenFile(filepath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
|
localfile, _ := os.OpenFile(filepath, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0666)
|
||||||
logger.Println("file uploaded :", localfile)
|
|
||||||
if localfile != nil {
|
if localfile != nil {
|
||||||
defer localfile.Close()
|
defer localfile.Close()
|
||||||
if _, err = io.Copy(localfile, r.Body); err != nil {
|
if _, err = io.Copy(localfile, r.Body); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user