feat(watchdog): improve watchdog instance tracking
- Add Close() function to watchdog for graceful shutdown - Update instance message format for better consistency - Add watchdog status tracking in StatusInfo - Include watchdog field in FrpcInstance struct and database - Change port fields from string to int in FrpcProxyInfo - Add auth_token support in InstanceInfo
This commit is contained in:
+16
-2
@@ -9,7 +9,7 @@ func AddInstance(serviceName string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("[addInstance] <serviceName>%s</serviceName>", serviceName)
|
||||
message := fmt.Sprintf("[instance.add] <serviceName>%s</serviceName>", serviceName)
|
||||
response, err := sendMsg(message, 3)
|
||||
if err != nil {
|
||||
return false
|
||||
@@ -23,7 +23,7 @@ func RemoveInstance(serviceName string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
message := fmt.Sprintf("[removeInstance] <serviceName>%s</serviceName>", serviceName)
|
||||
message := fmt.Sprintf("[instance.remove] <serviceName>%s</serviceName>", serviceName)
|
||||
response, err := sendMsg(message, 3)
|
||||
if err != nil {
|
||||
return false
|
||||
@@ -31,3 +31,17 @@ func RemoveInstance(serviceName string) bool {
|
||||
|
||||
return response == "success"
|
||||
}
|
||||
|
||||
func Close() bool {
|
||||
if !IsConnected() {
|
||||
return false
|
||||
}
|
||||
|
||||
message := "watchdog.shutdown"
|
||||
response, err := sendMsg(message, 3)
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return response == "success"
|
||||
}
|
||||
Reference in New Issue
Block a user