Them retry khi download module loi va bat truong hop gui lenh update module nhieu lan tu server
This commit is contained in:
Binary file not shown.
@@ -462,12 +462,14 @@ func MqttMessageHandler(MqttBI mqtt.Client, message mqtt.Message) {
|
||||
} else if list["method"] == "update_model" { // {"method":"update_model","status": 1}
|
||||
file.Println("Update_model \n")
|
||||
fmt.Printf("%v--%T", list["id_box_engine"], list["id_box_engine"])
|
||||
UpdateModule((int)((list["id_box_engine"]).(float64)))
|
||||
topic := strings.Replace(message.Topic(), "request", "response", 1)
|
||||
msg := `{"method":"update_model","status": ` + strconv.Itoa(1) + `}`
|
||||
file.Write_log("Message:"+msg+" \n", box.Path_log_luncher)
|
||||
CmsResponse(MqttBI, topic, msg)
|
||||
file.Println("UpdateModule done\n")
|
||||
if SttUpdate == false {
|
||||
UpdateModule((int)((list["id_box_engine"]).(float64)))
|
||||
topic := strings.Replace(message.Topic(), "request", "response", 1)
|
||||
msg := `{"method":"update_model","status": ` + strconv.Itoa(1) + `}`
|
||||
file.Write_log("Message:"+msg+" \n", box.Path_log_luncher)
|
||||
CmsResponse(MqttBI, topic, msg)
|
||||
file.Println("UpdateModule done\n")
|
||||
}
|
||||
|
||||
} else if list["method"] == "inactive_box" {
|
||||
file.Println("Inactive Box\n")
|
||||
@@ -557,11 +559,13 @@ func MqttMessageHandler(MqttBI mqtt.Client, message mqtt.Message) {
|
||||
|
||||
}
|
||||
func UpdateModule(id_engine int) {
|
||||
file.Write_log("-------- START UPDATE MODULE ----------", box.Path_log_luncher)
|
||||
SttUpdate = true
|
||||
box.Stop_check_engine()
|
||||
box.Stop_Server_Engine()
|
||||
box.RequestUpdate_Module(box.Url_module, id_engine)
|
||||
SttUpdate = false
|
||||
file.Write_log("---------------------------------------", box.Path_log_luncher)
|
||||
}
|
||||
func UpdateEngine() {
|
||||
SttUpdate = true
|
||||
|
||||
Reference in New Issue
Block a user