diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..081b737fd3148bfde1ecb2c9d9212d2bcaf95092 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# 默认忽略的文件 +/shelf/ +/workspace.xml +# 数据源本地存储已忽略文件 +/dataSources/ +/dataSources.local.xml +# 基于编辑器的 HTTP 客户端请求 +/httpRequests/ diff --git a/.idea/goactuator.iml b/.idea/goactuator.iml new file mode 100644 index 0000000000000000000000000000000000000000..5e764c4f0b9a64bb78a5babfdd583713b2df47bf --- /dev/null +++ b/.idea/goactuator.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000000000000000000000000000000000000..8d8723f28b9ea04881b2841f23a01eb94fd643d0 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..94a25f7f4cb416c083d265558da75d457237d671 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/2021-10-26.log b/src/2021-10-26.log new file mode 100644 index 0000000000000000000000000000000000000000..6ef1aee3177ec1540336697dcff14079177560b8 --- /dev/null +++ b/src/2021-10-26.log @@ -0,0 +1,3 @@ +2021/10/26 18:09:29 main.go:20: getRunnableSlotList error:got null address +2021/10/26 18:09:29 main.go:46: getRunnableDaemonList error:got null address +2021/10/26 18:09:29 main.go:72: getTerminatedDaemonList error:got null address diff --git a/src/actuator/actuatotFeatures.go b/src/actuator/actuatotFeatures.go index 65337c9feaaf1aeff88ef220124733d095e51ad8..9876efbf1dbe895ad8981a661b43beacecf95d68 100644 --- a/src/actuator/actuatotFeatures.go +++ b/src/actuator/actuatotFeatures.go @@ -2,6 +2,7 @@ package actuator import ( "context" + "errors" "github.com/golang/protobuf/ptypes/empty" wrps "github.com/golang/protobuf/ptypes/wrappers" pb "goactuator/scalebox" @@ -16,10 +17,12 @@ var address =os.Getenv("grpc_server") var logger,_= MakeLog("./") -func GetRunnableSlotList() ([]*pb.Command,error) { - //test - address =os.Getenv("grpc_server") +func GetRunnableSlotList() ([]*pb.Command,error) { + //avoid grpc panic due to get null ip addr + if address==""{ + return nil,errors.New("got null server address") + } //connecting conn, err := grpc.Dial(address, grpc.WithInsecure()) if err != nil { @@ -40,6 +43,10 @@ func GetRunnableSlotList() ([]*pb.Command,error) { } func GetRunnableDaemonList() ([]*pb.Command,error) { + //avoid grpc panic due to get null ip addr + if address==""{ + return nil,errors.New("got null server address") + } //connecting conn, err := grpc.Dial(address, grpc.WithInsecure()) if err != nil { @@ -59,6 +66,10 @@ func GetRunnableDaemonList() ([]*pb.Command,error) { } func GetTerminatedDaemonList() ([]*pb.Command,error) { + //avoid grpc panic due to get null ip addr + if address==""{ + return nil,errors.New("got null server address") + } //connecting conn, err := grpc.Dial(address, grpc.WithInsecure()) if err != nil { @@ -84,6 +95,10 @@ func GetTerminatedDaemonList() ([]*pb.Command,error) { func SetSlotInitialized(cmdPkg *pb.Command)error { + //avoid grpc panic due to get null ip addr + if address==""{ + return errors.New("got null server address") + } //connecting conn, err := grpc.Dial(address, grpc.WithInsecure()) if err != nil { @@ -106,6 +121,10 @@ func SetSlotInitialized(cmdPkg *pb.Command)error { func SetRunnableDaemonInitialized(cmdPkg *pb.Command)error { + //avoid grpc panic due to get null ip addr + if address==""{ + return errors.New("got null server address") + } //connecting conn, err := grpc.Dial(address, grpc.WithInsecure()) if err != nil { @@ -126,6 +145,10 @@ func SetRunnableDaemonInitialized(cmdPkg *pb.Command)error { } func SetRunnableDaemonTerminated(cmdPkg *pb.Command)error{ + //avoid grpc panic due to get null ip addr + if address==""{ + return errors.New("got null address") + } //connecting conn, err := grpc.Dial(address, grpc.WithInsecure()) if err != nil { diff --git a/src/main/2021-10-26.log b/src/main/2021-10-26.log new file mode 100644 index 0000000000000000000000000000000000000000..bd5e83f0132407bb98dc280a8993ccd689d8b7ca --- /dev/null +++ b/src/main/2021-10-26.log @@ -0,0 +1,3 @@ +2021/10/26 18:15:25 main.go:20: getRunnableSlotList error:got null address +2021/10/26 18:15:25 main.go:46: getRunnableDaemonList error:got null address +2021/10/26 18:15:25 main.go:72: getTerminatedDaemonList error:got null address diff --git a/src/main/main b/src/main/main new file mode 100755 index 0000000000000000000000000000000000000000..8cc6ae8e70a83c8f36a971ea6bf1b6aa800ce71f Binary files /dev/null and b/src/main/main differ diff --git a/src/main/main.go b/src/main/main.go index 7ed5f5e3ba81e4da7207cb87d7d6b33b6c7306a6..9bcf35b9ae9066b6f97ee04aa95833c7dd5d3254 100644 --- a/src/main/main.go +++ b/src/main/main.go @@ -13,6 +13,7 @@ var logger,_= MakeLog("./") func main() { for { + log.Println(":Getting SlotList>>>") commandList, err :=GetRunnableSlotList() if err != nil { log.Printf("getRunnableSlotList error:%v", err) @@ -38,6 +39,7 @@ func main() { } } + log.Println(":Getting DaemonList>>>") commandList,err=GetRunnableDaemonList() if err != nil { log.Printf("getRunnableDaemonList error:%v", err) @@ -63,10 +65,11 @@ func main() { } } + log.Println(":Getting Daemon2TerminatedList>>>") commandList,err=GetTerminatedDaemonList() if err != nil { log.Printf("getTerminatedDaemonList error:%v", err) - logger.Fatalf("getTerminatedDaemonList error:%v", err) + logger.Printf("getTerminatedDaemonList error:%v", err) }else { if len(commandList) != 0 { @@ -87,8 +90,7 @@ func main() { } } } - - + log.Println("Going to sleep for 2m") time.Sleep(time.Second*120) }