优化进程启动

This commit is contained in:
boyce
2024-03-01 17:35:32 +08:00
parent 39b862e3d9
commit ecea9d1706
3 changed files with 30 additions and 23 deletions

View File

@@ -19,6 +19,7 @@ import (
"strings"
"syscall"
"time"
"github.com/shirou/gopsutil/process"
)
var sig chan os.Signal
@@ -236,6 +237,7 @@ func retireNode(args interface{}) error {
return err
}
RetireProcess(processId)
return nil
}
@@ -287,6 +289,14 @@ func startNode(args interface{}) error {
if err != nil {
return fmt.Errorf("invalid option %s", param)
}
processId, err := getRunProcessPid(nodeId)
if err != nil {
return err
}
ok,_ := process.PidExists(int32(processId))
if ok == true {
return fmt.Errorf("repeat runs are not allowed,node is %d,processid is %d",nodeId,processId)
}
timer.StartTimer(10*time.Millisecond, 1000000)
log.Info("Start running server.")