Skip to content

Commit 79c2d08

Browse files
committed
Fix proto response not being flushed to bytebuf
1 parent 3857b27 commit 79c2d08

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

x-pack/plugin/metricsdb/src/main/java/org/elasticsearch/xpack/metrics/MetricsDBRestAction.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,9 @@ public RestResponse buildResponse(MetricsDBTransportAction.MetricsResponse r) th
7070

7171
private RestResponse successResponse(MessageLite response) throws IOException {
7272
var responseBytes = ByteBuffer.allocate(response.getSerializedSize());
73-
response.writeTo(CodedOutputStream.newInstance(responseBytes));
73+
CodedOutputStream outputStream = CodedOutputStream.newInstance(responseBytes);
74+
response.writeTo(outputStream);
75+
outputStream.flush();
7476

7577
return new RestResponse(RestStatus.OK, "application/x-protobuf", BytesReference.fromByteBuffer(responseBytes));
7678
}

0 commit comments

Comments
 (0)