From d3ce672d962e04a09f34d078eaf2031182bb4527 Mon Sep 17 00:00:00 2001 From: Xin Zheng Date: Mon, 27 Nov 2023 15:14:31 +0700 Subject: [PATCH] removed some checks --- src/main/java/org/swisspush/redisques/RedisQues.java | 6 +++--- .../redisques/handler/RedisquesHttpRequestHandler.java | 7 +++---- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/org/swisspush/redisques/RedisQues.java b/src/main/java/org/swisspush/redisques/RedisQues.java index 36872cab..9c611307 100644 --- a/src/main/java/org/swisspush/redisques/RedisQues.java +++ b/src/main/java/org/swisspush/redisques/RedisQues.java @@ -598,7 +598,7 @@ private Future readQueue(final String queueName) { } if (answer.result() != null) { dequeueStatistic.computeIfAbsent(queueName, s -> new DequeueStatistic()); - dequeueStatistic.get(queueName).lastDequeueAttemptTimestamp = new Date().getTime(); + dequeueStatistic.get(queueName).lastDequeueAttemptTimestamp = System.currentTimeMillis(); processMessageWithTimeout(queueName, answer.result().toString(), success -> { // update the queue failure count and get a retry interval @@ -685,7 +685,7 @@ private void rescheduleSendMessageAfterFailure(final String queueName, int retry log.trace("RedsQues reschedule after failure for queue: {}", queueName); } long retryDelayInMills = retryInSeconds * 1000L; - dequeueStatistic.get(queueName).nextDequeueDueTimestamp = new Date().getTime() + retryDelayInMills; + dequeueStatistic.get(queueName).nextDequeueDueTimestamp = System.currentTimeMillis() + retryDelayInMills; vertx.setTimer(retryDelayInMills, timerId -> { if (log.isDebugEnabled()) { log.debug("RedisQues re-notify the consumer of queue '{}' at {}", queueName, new Date(System.currentTimeMillis())); @@ -723,7 +723,7 @@ private void processMessageWithTimeout(final String queue, final String payload, boolean success; if (reply.succeeded()) { success = OK.equals(reply.result().body().getString(STATUS)); - dequeueStatistic.get(queue).lastDequeueSuccessTimestamp = new Date().getTime(); + dequeueStatistic.get(queue).lastDequeueSuccessTimestamp = System.currentTimeMillis(); dequeueStatistic.get(queue).nextDequeueDueTimestamp = null; } else { log.info("RedisQues QUEUE_ERROR: Consumer failed {} queue: {} ({})", uid, queue, reply.cause().getMessage()); diff --git a/src/main/java/org/swisspush/redisques/handler/RedisquesHttpRequestHandler.java b/src/main/java/org/swisspush/redisques/handler/RedisquesHttpRequestHandler.java index 34779bca..0382e26b 100644 --- a/src/main/java/org/swisspush/redisques/handler/RedisquesHttpRequestHandler.java +++ b/src/main/java/org/swisspush/redisques/handler/RedisquesHttpRequestHandler.java @@ -513,9 +513,8 @@ private void getMonitorInformation(RoutingContext ctx) { queuesList = limitJsonQueueArray(queuesList, limit); } Map dequeueProcessStatistic = redisQues.getDequeueStatistic(); - if (dequeueProcessStatistic.size() > 0) { - fillStatisticToQueuesList(queuesList, dequeueProcessStatistic); - } + fillStatisticToQueuesList(queuesList, dequeueProcessStatistic); + JsonObject resultObject = new JsonObject(); resultObject.put(QUEUES, queuesList); jsonResponse(ctx.response(), resultObject); @@ -548,7 +547,7 @@ private void fillStatisticToQueuesList(List queuesList, Map