Manager: prevent error when fetching task that was never assigned
Prevent an error when fetching a task that was never assigned to a worker. The error: ``` WRN error fetching task worker error="fetching worker : worker not found: sql: no rows in result set" ```
This commit is contained in:
parent
234cfbf983
commit
8b322e84f8
@ -138,6 +138,7 @@ func (f *Flamenco) FetchTask(e echo.Context, taskID string) error {
|
||||
}
|
||||
apiTask := taskJobWorkertoAPI(taskJobWorker)
|
||||
|
||||
if taskJobWorker.WorkerUUID != "" {
|
||||
// Fetch the worker. TODO: get rid of this conversion, just include the
|
||||
// worker's UUID and let the caller fetch the worker info themselves if
|
||||
// necessary.
|
||||
@ -147,6 +148,7 @@ func (f *Flamenco) FetchTask(e echo.Context, taskID string) error {
|
||||
return sendAPIError(e, http.StatusInternalServerError, "error fetching task worker")
|
||||
}
|
||||
apiTask.Worker = workerToTaskWorker(taskWorker)
|
||||
}
|
||||
|
||||
// Fetch & convert the failure list.
|
||||
failedWorkers, err := f.persist.FetchTaskFailureList(ctx, &taskJobWorker.Task)
|
||||
|
Loading…
x
Reference in New Issue
Block a user