server/requestJob: failing to read job status is fatal

Error out early in case reading a job status fails. The state would otherwise
be inconsistent if only some of the job statuses have been read out.
This commit is contained in:
Tom Gundersen 2022-03-15 20:04:20 +00:00
parent a8adb59995
commit ac642c3d70

View file

@ -452,13 +452,18 @@ func (s *Server) requestJob(ctx context.Context, arch string, jobTypes []string,
jobType, status, _, err := s.jobStatus(jobId, nil)
if err != nil {
logrus.Errorf("error retrieving job status: %v", err)
return
} else {
prometheus.DequeueJobMetrics(status.Queued, status.Started, jobType)
}
for _, depID := range depIDs {
// TODO: include type of arguments
_, result, _, _, _, _, _, _ := s.jobs.JobStatus(depID)
var result json.RawMessage
_, result, _, _, _, _, _, err = s.jobs.JobStatus(depID)
if err != nil {
return
}
dynamicArgs = append(dynamicArgs, result)
}