Open christo-3 opened 3 years ago
@christo-3 is there a use case you have where you would like to see a Location header for the scale action? Or would it be sufficient to correct the docs? @ctlong since you opened a similar issue, did you have any thoughts about this?
I'm not seeing anything in the HTTP specs that require the location header for 202 Accepted
responses, it just seems to be something we provide (in fact, it seems our use of the Location header for 202 response is slightly unconventional). My preference would be to note this endpoint being an exception in the docs, unless we have a good reason to do otherwise.
I've no good reasons to do more than a doc update 👍 Although my preference would be to find some clever way to setup a job for this request, I've no good reasons to go that far. In a perfect world client procedures wouldn't have to be altered specifically for this endpoint.
Extra thoughts 🤔 IIRC the problem is that this endpoint is asynchronous, because it requires Diego to read the new desired state and change the actual state of the process, but it doesn't use a job because Diego will just handle it. Potentially terrible idea: return a job that intermittently polls Diego and succeeds when the actual state reflects the desired state.
I believe the scale endpoint predates the Location header pattern we adopted, which may be why it uses 202 differently. I am hesitant to change it to return 200 since that is potentially a breaking change for clients.
I see the value in making all 202 responses consistent so that clients don't have to work with exceptions. I'm not sure about creating a job that doesn't actually do any work--to me that feels a little like faking it. There are also some edge cases to think about. For example, if there is an issue where the app cannot be scaled up (too much memory requested, for instance), I believe the app instance just ends up thrashing. In cases like those, we might end up with never-ending jobs.
That said, I am in favor of making a doc change for now and seeing if anyone has a compelling use case to why this should be changed.
Thanks for submitting an issue to
cloud_controller_ng
. We are always trying to improve! To help us, please fill out the following template.Issue
(There may be other places this happens)
Either Documentation for V3 async opertations is incorrect or POST
v3/processes/:guid/actions/scale
is not functioning as intendedDocumentation says "Instead, endpoints that require asynchronous processing will return 202 Accepted with a Location header pointing to the job resource to poll."
But scaling an app using
v3/processes/:guid/actions/scale
returns a 202 Accepted with a body and NO Location header.Context