[ Status ] optimize the code

This commit is contained in:
IceDerce
2023-06-15 17:03:22 +08:00
parent 4b3f7be1dd
commit 54569cc41b
17 changed files with 123 additions and 157 deletions

View File

@@ -118,12 +118,18 @@ func executorOMHandler(octopusMessage *OctopusMessage) {
func statusOMHandler(octopusMessage *OctopusMessage) {
v, ok := (octopusMessage.Content).(string)
if !ok {
log.ErrorF("convert to string is wrong %s", v)
}
statusMsgString := octopusMessage.Content.(string)
var statusMessage *status.StatusMessage
err := json.Unmarshal([]byte(statusMsgString), &statusMessage)
if err != nil {
log.Error(fmt.Sprintf("status message convert to json is wrong! msg is => %s", statusMsgString))
fmt.Println(err.Error())
log.Error(fmt.Sprintf("status message convert to json is wrong! msg is => %s", octopusMessage))
return
}