Skip to content

Commit

Permalink
add simple logging about HttpResponseStatus.TOO_MANY_REQUESTS and Htt…
Browse files Browse the repository at this point in the history
…pResponseStatus.INTERNAL_SERVER_ERROR (#58)
  • Loading branch information
kortemik authored May 6, 2024
1 parent 925d21b commit c9de197
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/main/java/com/teragrep/lsh_01/MessageProcessor.java
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ public class MessageProcessor implements RejectableRunnable {
public void onRejection() {
try {
final FullHttpResponse response = generateFailedResponse(HttpResponseStatus.TOO_MANY_REQUESTS);
LOGGER.warn("Too many requests, returning code <{}>", response.status().code());
ctx.writeAndFlush(response);
}
finally {
Expand Down Expand Up @@ -140,7 +141,9 @@ private FullHttpResponse processMessage(Subject subject) {
return generateResponse(messageHandler.responseHeaders());
}
else {
return generateFailedResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR);
FullHttpResponse response = generateFailedResponse(HttpResponseStatus.INTERNAL_SERVER_ERROR);
LOGGER.warn("Processing failed, returning code <{}>", response.status().code());
return response;
}
}

Expand Down

0 comments on commit c9de197

Please sign in to comment.