worker/server: make JobStatus() return JobStatus struct

Personally, I don't like methods returning too much values. I think it's
easy to assign the values in an incorrect order and thus interpreting them
in a wrong way. Also, the following commits will make JobStatus() return
also the JobResult, which would make the number of returned values even
higher.

Not a functional change.
This commit is contained in:
Ondřej Budai 2020-05-15 11:37:16 +02:00 committed by Lars Karlitski
parent 8b58d2c91a
commit fa5b775718
2 changed files with 20 additions and 9 deletions

View file

@ -168,8 +168,9 @@ func (api *API) getComposeState(compose store.Compose) (state common.ComposeStat
return
}
state, queued, started, finished, _ = api.workers.JobStatus(jobId)
return
// is it ok to ignore this error?
jobStatus, _ := api.workers.JobStatus(jobId)
return jobStatus.State, jobStatus.Queued, jobStatus.Started, jobStatus.Finished
}
func verifyRequestVersion(writer http.ResponseWriter, params httprouter.Params, minVersion uint) bool {