| @@ -84,7 +84,15 @@ type AiModelQueryOptions struct { | |||||
| Status int | Status int | ||||
| } | } | ||||
| func ComputeAndSetDuration(task *AiModelConvert) { | |||||
| func ModelComputeAndSetDuration(task *AiModelConvert, result JobResultPayload) { | |||||
| if task.StartTime == 0 { | |||||
| task.StartTime = timeutil.TimeStamp(result.JobStatus.CreatedTime / 1000) | |||||
| } | |||||
| if task.EndTime == 0 { | |||||
| if result.JobStatus.CompletedTime > 0 { | |||||
| task.EndTime = timeutil.TimeStamp(result.JobStatus.CompletedTime / 1000) | |||||
| } | |||||
| } | |||||
| var d int64 | var d int64 | ||||
| if task.StartTime == 0 { | if task.StartTime == 0 { | ||||
| d = 0 | d = 0 | ||||
| @@ -135,7 +135,7 @@ func GetCloudbrainModelConvertTask(ctx *context.APIContext) { | |||||
| } | } | ||||
| if result.JobStatus.State != string(models.JobWaiting) { | if result.JobStatus.State != string(models.JobWaiting) { | ||||
| models.ComputeAndSetDuration(job, result) | |||||
| models.ModelComputeAndSetDuration(job, result) | |||||
| err = models.UpdateModelConvert(job) | err = models.UpdateModelConvert(job) | ||||
| if err != nil { | if err != nil { | ||||
| log.Error("UpdateJob failed:", err) | log.Error("UpdateJob failed:", err) | ||||