cloudapi/v2/server: assure order of fail-calls
by avoiding map but rather using a slice the order of SetFailed is maintained
This commit is contained in:
parent
ca3f0a190f
commit
02778b5361
1 changed files with 12 additions and 9 deletions
|
|
@ -469,18 +469,21 @@ func serializeManifest(ctx context.Context, manifestSource *manifest.Manifest, w
|
||||||
if jobResult.JobError != nil {
|
if jobResult.JobError != nil {
|
||||||
// set all jobs to "failed"
|
// set all jobs to "failed"
|
||||||
// osbuild job will fail as dependency
|
// osbuild job will fail as dependency
|
||||||
jobs := map[string]uuid.UUID{
|
jobs := []struct {
|
||||||
"depsolve": depsolveJobID,
|
Name string
|
||||||
"containerResolve": containerResolveJobID,
|
ID uuid.UUID
|
||||||
"ostreeResolve": ostreeResolveJobID,
|
}{
|
||||||
"manifest": manifestJobID,
|
{"depsolve", depsolveJobID},
|
||||||
|
{"containerResolve", containerResolveJobID},
|
||||||
|
{"ostreeResolve", ostreeResolveJobID},
|
||||||
|
{"manifest", manifestJobID},
|
||||||
}
|
}
|
||||||
|
|
||||||
for jobName, jobID := range jobs {
|
for _, job := range jobs {
|
||||||
if jobID != uuid.Nil {
|
if job.ID != uuid.Nil {
|
||||||
err := workers.SetFailed(jobID, jobResult.JobError)
|
err := workers.SetFailed(job.ID, jobResult.JobError)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logWithId.Errorf("Error failing %s job: %v", jobName, err)
|
logWithId.Errorf("Error failing %s job: %v", job.Name, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue