diff --git a/.changelog/18637.txt b/.changelog/18637.txt new file mode 100644 index 00000000000..aaa01ad4a5f --- /dev/null +++ b/.changelog/18637.txt @@ -0,0 +1,3 @@ +```release-note:bug +scaling: Unblock blocking queries to /v1/job/{job-id}/scale if the job goes away +``` diff --git a/nomad/job_endpoint.go b/nomad/job_endpoint.go index 44e1bc1a4ac..54b1345f136 100644 --- a/nomad/job_endpoint.go +++ b/nomad/job_endpoint.go @@ -2209,8 +2209,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)