From 6a3c9925fbb20543acefd42eaf3b89909c8f92e9 Mon Sep 17 00:00:00 2001 From: Ildar Nurislamov Date: Tue, 5 Sep 2023 17:19:06 +0400 Subject: [PATCH] syncctl: task timeout fix --- sync-controller/job_runner.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sync-controller/job_runner.go b/sync-controller/job_runner.go index ad35e7a..63fcb0a 100644 --- a/sync-controller/job_runner.go +++ b/sync-controller/job_runner.go @@ -101,9 +101,10 @@ func (j *JobRunner) watchPodStatuses() { } else { if timeMark, ok := j.runningPods[pod.Name]; !ok || time.Now().Sub(timeMark) >= time.Minute { if time.Now().Sub(taskStatus.StartedAtTime()) > time.Hour*time.Duration(j.config.TaskTimeoutHours) { + taskStatus.Status = StatusFailed + taskStatus.Description = fmt.Sprintf("Task timeout: task %s is running for more than %d hours.", taskStatus.TaskID, j.config.TaskTimeoutHours) j.Errorf("Pod %s is running for more than %d hours. Deleting", pod.Name, j.config.TaskTimeoutHours) j.cleanupPod(pod.Name) - continue } else { taskStatus.Status = StatusRunning j.Infof("Pod %s is running", pod.Name)