Skip to content

Commit

Permalink
Addressing comment
Browse files Browse the repository at this point in the history
Signed-off-by: Bharathwaj G <[email protected]>
  • Loading branch information
bharath-techie committed Sep 5, 2022
1 parent 13b5f4c commit 660b3d5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,14 @@ public void writeTo(StreamOutput out) throws IOException {
args -> new ListPitInfo((String) args[0], (long) args[1], (long) args[2])
);

static {
PARSER.declareString(constructorArg(), new ParseField("pit_id"));
PARSER.declareLong(constructorArg(), new ParseField("creation_time"));
PARSER.declareLong(constructorArg(), new ParseField("keep_alive"));
}

private static final ParseField CREATION_TIME = new ParseField("creation_time");
private static final ParseField PIT_ID = new ParseField("pit_id");
private static final ParseField KEEP_ALIVE = new ParseField("keep_alive");
static {
PARSER.declareString(constructorArg(), new ParseField(PIT_ID.getPreferredName()));
PARSER.declareLong(constructorArg(), new ParseField(CREATION_TIME.getPreferredName()));
PARSER.declareLong(constructorArg(), new ParseField(KEEP_ALIVE.getPreferredName()));
}

@Override
public XContentBuilder toXContent(XContentBuilder builder, Params params) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ public RestResponse buildResponse(final GetAllPitNodesResponse getAllPITNodesRes
}
builder.field("pits", getAllPITNodesResponse.getPitInfos());
builder.endObject();
if (getAllPITNodesResponse.getPitInfos().isEmpty()) {
if (getAllPITNodesResponse.hasFailures()) {
return new BytesRestResponse(RestStatus.INTERNAL_SERVER_ERROR, builder);
} else if (getAllPITNodesResponse.getPitInfos().isEmpty()) {
return new BytesRestResponse(RestStatus.NOT_FOUND, builder);
}
return new BytesRestResponse(RestStatus.OK, builder);
Expand Down

0 comments on commit 660b3d5

Please sign in to comment.