Skip to content

Commit

Permalink
removed some checks
Browse files Browse the repository at this point in the history
  • Loading branch information
Xin Zheng committed Nov 27, 2023
1 parent a9e3281 commit d3ce672
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/main/java/org/swisspush/redisques/RedisQues.java
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ private Future<Void> 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
Expand Down Expand Up @@ -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()));
Expand Down Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,9 +513,8 @@ private void getMonitorInformation(RoutingContext ctx) {
queuesList = limitJsonQueueArray(queuesList, limit);
}
Map<String, RedisQues.DequeueStatistic> 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);
Expand Down Expand Up @@ -548,7 +547,7 @@ private void fillStatisticToQueuesList(List<JsonObject> queuesList, Map<String,
entries.put(MONITOR_QUEUE_LAST_DEQUEUE_SUCCESS, DATE_FORMAT.format(new Date(dequeueStatistic.lastDequeueSuccessTimestamp)));

Check warning on line 547 in src/main/java/org/swisspush/redisques/handler/RedisquesHttpRequestHandler.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/swisspush/redisques/handler/RedisquesHttpRequestHandler.java#L547

Added line #L547 was not covered by tests
}
if (dequeueStatistic.nextDequeueDueTimestamp != null) {
entries.put(MONITOR_QUEUE_NEXT_DEQUEUE_DUE_TS, dequeueStatistic.nextDequeueDueTimestamp.toString());
entries.put(MONITOR_QUEUE_NEXT_DEQUEUE_DUE_TS, DATE_FORMAT.format(new Date(dequeueStatistic.nextDequeueDueTimestamp)));
}
}
});
Expand Down

0 comments on commit d3ce672

Please sign in to comment.