From a0d1aa4e540fb0a0610825add9ba8ee2e432f74f Mon Sep 17 00:00:00 2001 From: Mark Nellemann Date: Fri, 3 Mar 2023 10:37:08 +0100 Subject: [PATCH] Do not store empty messages. --- src/main/java/hello/HelloController.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/hello/HelloController.java b/src/main/java/hello/HelloController.java index 882c6fd..166cfbe 100644 --- a/src/main/java/hello/HelloController.java +++ b/src/main/java/hello/HelloController.java @@ -69,8 +69,10 @@ public class HelloController { @Consumes(MediaType.APPLICATION_FORM_URLENCODED) public HttpResponse ping(String message) { log.info(message); - counter++; - msgDeque.push(message); + if(!message.isEmpty()) { + counter++; + msgDeque.push(message); + } if(msgDeque.size() > 25) { log.debug("Message deque: {}", msgDeque.size()); msgDeque.removeLast();