My goal is to poll for a job’s status using the read job api
This endpoint supports the blocking query mechanism, which I’d like to leverage. However, in the case of an error—specifically when the job is not found (HTTP 404)—the response omits the query metadata, and the X-Nomad-Index is not returned.
See query here:
rtt, resp, err := requireOK(c.doRequest(r)) //nolint:bodyclose // Closing the body is the caller's responsibility.
if err != nil {
return nil, err
}
How am I expected to retrieve the index when the job is not found (404)? My goal is to use blocking queries to avoid aggressive polling, but without an index in the error response, it’s unclear how to proceed..