Check for number of workers before soft failing the task. #104195

Merged
Sybren A. Stüvel merged 15 commits from Nitin-Rawat-1/flamenco:104190-job-stuck into main 2023-04-20 11:53:43 +02:00
Showing only changes of commit ac88d57ede - Show all commits

View File

@ -188,7 +188,7 @@ func (f *Flamenco) onTaskFailed(
Int("threshold", threshold).
Logger()
Nitin-Rawat-1 marked this conversation as resolved Outdated

If you flip this condition, you can return early and reduce the nesting level of the following code.

if numFailed > threshold {
    return f.hardFailTask(ctx, logger, worker, task, numFailed)
}
numWorkers, err := f.numWorkersCapableOfRunningTask(ctx, task)
...
If you flip this condition, you can return early and reduce the nesting level of the following code. ```go if numFailed > threshold { return f.hardFailTask(ctx, logger, worker, task, numFailed) } numWorkers, err := f.numWorkersCapableOfRunningTask(ctx, task) ... ```
if numFailed > threshold {
if numFailed >= threshold {
return f.hardFailTask(ctx, logger, worker, task, numFailed)
}