优化重复启动验证

This commit is contained in:
boyce
2024-03-08 10:32:32 +08:00
parent 2ddc54f5ac
commit eebbef52c9

View File

@@ -289,9 +289,10 @@ func startNode(args interface{}) error {
if err != nil {
return fmt.Errorf("invalid option %s", param)
}
processId, err := getRunProcessPid(nodeId)
if err != nil {
return err
for{
processId, pErr := getRunProcessPid(nodeId)
if pErr != nil {
break
}
name, cErr := sysprocess.GetProcessNameByPID(int32(processId))
@@ -307,20 +308,24 @@ func startNode(args interface{}) error {
log.SInfo(fmt.Sprintf("repeat runs are not allowed,node is %d,processid is %d",nodeId,processId))
os.Exit(-1)
}
break
}
timer.StartTimer(10*time.Millisecond, 1000000)
//2.记录进程id号
log.Info("Start running server.")
//2.初始化node
writeProcessPid(nodeId)
timer.StartTimer(10*time.Millisecond, 1000000)
//3.初始化node
initNode(nodeId)
//3.运行service
//4.运行service
service.Start()
//4.运行集群
//5.运行集群
cluster.GetCluster().Start()
//5.记录进程id号
writeProcessPid(nodeId)
//6.监听程序退出信号&性能报告
bRun := true