mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
scaling: set Index on nil-job scale status reply (#18637)
returning a nil error in a blockingOptions.run() without increasing the reply Index can cause the query to block indefinitely (until timeout). this fixes that happening in Job.ScaleStatus when the job is deleted -- the job going away should now return as not-found and provide a new index for the caller to try if they so please.
This commit is contained in:
3
.changelog/18637.txt
Normal file
3
.changelog/18637.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
scaling: Unblock blocking queries to /v1/job/{job-id}/scale if the job goes away
|
||||
```
|
||||
@@ -2216,8 +2216,13 @@ func (j *Job) ScaleStatus(args *structs.JobScaleStatusRequest,
|
||||
return err
|
||||
}
|
||||
if job == nil {
|
||||
// HTTPServer.jobScaleStatus() will 404 if this is nil
|
||||
reply.JobScaleStatus = nil
|
||||
return nil
|
||||
|
||||
// reply with latest index, since if the job does get created,
|
||||
// it must necessarily be later than current latest.
|
||||
reply.Index, err = state.LatestIndex()
|
||||
return err
|
||||
}
|
||||
|
||||
events, eventsIndex, err := state.ScalingEventsByJob(ws, args.RequestNamespace(), args.JobID)
|
||||
|
||||
Reference in New Issue
Block a user