Extract ResponseLengthRecorder in REST layer#104836
Extract ResponseLengthRecorder in REST layer#104836elasticsearchmachine merged 2 commits intoelastic:mainfrom
ResponseLengthRecorder in REST layer#104836Conversation
Related to elastic#104752, we should not be confounding the lifecycle of the `EncodedLengthTrackingChunkedRestResponseBody` with the lifecycle of the overall `RestResponse`. This commit introduces a separate object to record the total response length whose lifecycle is independent of that of the response body.
|
Pinging @elastic/es-distributed (Team:Distributed) |
ywangd
left a comment
There was a problem hiding this comment.
LGTM
Just a discussion point: IIUC, the change is to align EncodedLengthTrackingChunkedRestResponseBody with the new ChunkedRestResponseBody interface to not implement Releasable. While I do think it makes sense to have the overall RestReponse implement Releasable, I found the new code a bit more challenging to follow. Maybe it is OK for both RestResponse and ChunkedRestResponseBody to implement Releasable. I think this is not unreasonable and this PR may not even be necessary in the case?
|
This fell out of some work to make it so that a |
|
FWIW this was opened to prepare things for #104851. |
Related to #104752, we should not be confounding the lifecycle of the
EncodedLengthTrackingChunkedRestResponseBodywith the lifecycle of theoverall
RestResponse. This commit introduces a separate object torecord the total response length whose lifecycle is independent of that
of the response body.