Add missing Return

This commit is contained in:
speatzle 2024-05-21 16:43:35 +02:00
parent 6df0d49249
commit 93cd12c6b6

View file

@ -204,14 +204,14 @@ func updateWorkerTaskStatus(ctx context.Context) {
// Find better way to compare errors which where send via websocket // Find better way to compare errors which where send via websocket
if strings.HasSuffix(err.Error(), constants.ErrTaskDoesNotExist.Error()) { if strings.HasSuffix(err.Error(), constants.ErrTaskDoesNotExist.Error()) {
// Worker says it does not know of this task, mark it failed so that we don't asks the worker about it again and again // Worker says it does not know of this task, mark it failed so that we don't asks the worker about it again and again
slog.ErrorContext(ctx, "Task is unkown by worker, Failing...", "err", err) slog.ErrorContext(ctx, "Task is unknown by worker, Failing...", "err", err)
_, err = db.Exec(ctx, "UPDATE tasks SET status = $2, log = log || $3 WHERE id = $1", ts.Task.ID, constants.TASK_STATUS_FAILED, []string{"Task Failed because it is unkown to Assigned Worker"}) _, err = db.Exec(ctx, "UPDATE tasks SET status = $2, log = log || $3 WHERE id = $1", ts.Task.ID, constants.TASK_STATUS_FAILED, []string{"Task Failed because it is unkown to Assigned Worker"})
if err != nil { if err != nil {
slog.ErrorContext(ctx, "Updating Failed Task Status", "err", err) slog.ErrorContext(ctx, "Updating Failed Task Status", "err", err)
return return
} }
return
} else if err != nil { } else if err != nil {
slog.ErrorContext(ctx, "Getting Task Status", "err", err) slog.ErrorContext(ctx, "Getting Task Status", "err", err)
@ -220,7 +220,6 @@ func updateWorkerTaskStatus(ctx context.Context) {
slog.ErrorContext(ctx, "Updating Unknown Task Status", "err", err) slog.ErrorContext(ctx, "Updating Unknown Task Status", "err", err)
return return
} }
return return
} }