Commit 8a5d323b authored by duanjinfei's avatar duanjinfei

add wait last task exec timeout

parent 36eb9196
......@@ -26,6 +26,7 @@ type Config struct {
ApiUrl string `json:"api_url"`
ValidatorUrl string `json:"validator_url"`
OssUrl string `json:"oss_url"`
WaitLastTaskExecTime int64 `json:"wait_last_task_exec_time"`
}
var _cfg *Config = nil
......
......@@ -7,5 +7,6 @@
"container_num": 1,
"chain_id": 100,
"validator_url": "43.198.29.144:20011",
"oss_url": "https://tmp-file.agicoin.ai/api/v1/upload"
"oss_url": "https://tmp-file.agicoin.ai/api/v1/upload",
"wait_last_task_exec_time": 10
}
\ No newline at end of file
......@@ -584,7 +584,14 @@ func (t *TaskHandler) checkLastTaskExecStatus(taskMsg *nodeManagerV1.PushTaskMes
t.IsExecStandardTask = true
}
if oldTaskId != taskMsg.TaskId {
now := time.Now()
for {
since := time.Since(now)
if int64(since.Seconds()) > conf.GetConfig().WaitLastTaskExecTime {
log.WithField("taskId", oldTaskId).Info("Waiting for last task execution ending")
oldTaskId = taskMsg.TaskId
break
}
if oldTaskId == "" {
oldTaskId = taskMsg.TaskId
break
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment