diff --git a/pom.xml b/pom.xml
index 237ad106..96eb3b42 100644
--- a/pom.xml
+++ b/pom.xml
@@ -2,7 +2,7 @@
4.0.0
org.swisspush
redisques
- 4.1.2-SNAPSHOT
+ 4.1.3-SNAPSHOT
redisques
A highly scalable redis-persistent queuing system for vertx
diff --git a/src/main/java/org/swisspush/redisques/QueueStatsService.java b/src/main/java/org/swisspush/redisques/QueueStatsService.java
index 71e1534e..f16cc811 100644
--- a/src/main/java/org/swisspush/redisques/QueueStatsService.java
+++ b/src/main/java/org/swisspush/redisques/QueueStatsService.java
@@ -187,14 +187,6 @@ private void fetchRetryDetails(GetQueueStatsRequest req, BiConsumer void attachDequeueStats(GetQueueStatsRequest req, BiConsumer> onDone) {
- // Setup a lookup table as we need to find by name further below.
- Map detailsByName = new HashMap<>(req.queuesJsonArr.size());
- for (var it = (Iterator) (Object) req.queuesJsonArr.iterator(); it.hasNext(); ) {
- JsonObject detailJson = it.next();
- String name = detailJson.getString(MONITOR_QUEUE_NAME);
- detailsByName.put(name, detailJson);
- }
-
dequeueStatisticCollector.getAllDequeueStatistics().onSuccess(event -> {
for (Queue queue : req.queues) {
if (event.containsKey(queue.name)) {
@@ -221,6 +213,7 @@ private static class GetQueueStatsRequest {
private CTX mCtx;
private GetQueueStatsMentor mentor;
private List queueNames;
+ /* TODO: Why is 'queuesJsonArr' never accessed? Isn't this the reason of our class in the first place? */
private JsonArray queuesJsonArr;
private List queues;
}
diff --git a/src/main/java/org/swisspush/redisques/RedisQues.java b/src/main/java/org/swisspush/redisques/RedisQues.java
index afb61e95..8fc491b5 100644
--- a/src/main/java/org/swisspush/redisques/RedisQues.java
+++ b/src/main/java/org/swisspush/redisques/RedisQues.java
@@ -230,12 +230,9 @@ private enum QueueState {
private final Semaphore getQueuesItemsCountRedisRequestQuota;
public RedisQues() {
- this.exceptionFactory = newThriftyExceptionFactory();
+ this(null, null, null, newThriftyExceptionFactory(), new Semaphore(Integer.MAX_VALUE),
+ new Semaphore(Integer.MAX_VALUE), new Semaphore(Integer.MAX_VALUE), new Semaphore(Integer.MAX_VALUE));
log.warn("Fallback to legacy behavior and allow up to {} simultaneous requests to redis", Integer.MAX_VALUE);
- this.redisMonitoringReqQuota = new Semaphore(Integer.MAX_VALUE);
- this.checkQueueRequestsQuota = new Semaphore(Integer.MAX_VALUE);
- this.queueStatsRequestQuota = new Semaphore(Integer.MAX_VALUE);
- this.getQueuesItemsCountRedisRequestQuota = new Semaphore(Integer.MAX_VALUE);
}
public RedisQues(
@@ -314,10 +311,6 @@ public void start(Promise promise) {
this.configurationProvider = new DefaultRedisquesConfigurationProvider(vertx, config());
}
- if (this.dequeueStatisticCollector == null) {
- this.dequeueStatisticCollector = new DequeueStatisticCollector(vertx);
- }
-
if (this.periodicSkipScheduler == null) {
this.periodicSkipScheduler = new PeriodicSkipScheduler(vertx);
}
@@ -326,11 +319,14 @@ public void start(Promise promise) {
log.info("Starting Redisques module with configuration: {}", configurationProvider.configuration());
int dequeueStatisticReportIntervalSec = modConfig.getDequeueStatisticReportIntervalSec();
- if (dequeueStatisticReportIntervalSec > 0) {
+ if (modConfig.isDequeueStatsEnabled()) {
dequeueStatisticEnabled = true;
Runnable publisher = newDequeueStatisticPublisher();
vertx.setPeriodic(1000L * dequeueStatisticReportIntervalSec, time -> publisher.run());
}
+ if (this.dequeueStatisticCollector == null) {
+ this.dequeueStatisticCollector = new DequeueStatisticCollector(vertx,dequeueStatisticEnabled);
+ }
queuesKey = modConfig.getRedisPrefix() + "queues";
queuesPrefix = modConfig.getRedisPrefix() + "queues:";
consumersPrefix = modConfig.getRedisPrefix() + "consumers:";
diff --git a/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java b/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java
index 589b35aa..35c83411 100644
--- a/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java
+++ b/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java
@@ -134,10 +134,10 @@ public void handle(AsyncResult handleQueues) {
var obj = new JsonObject().put(STATUS, OK).put(QUEUES, result);
long jsonCreateDurationMs = currentTimeMillis() - beginEpchMs;
if (jsonCreateDurationMs > 10) {
- log.info("Creating JSON with {} entries did block this tread for {}ms",
+ log.info("Creating JSON with {} entries did block this thread for {}ms",
ctx.queueLengths.length, jsonCreateDurationMs);
}else{
- log.debug("Creating JSON with {} entries did block this tread for {}ms",
+ log.debug("Creating JSON with {} entries did block this thread for {}ms",
ctx.queueLengths.length, jsonCreateDurationMs);
}
workerPromise.complete(obj);
diff --git a/src/main/java/org/swisspush/redisques/util/DequeueStatisticCollector.java b/src/main/java/org/swisspush/redisques/util/DequeueStatisticCollector.java
index 5f180186..bc5e1470 100644
--- a/src/main/java/org/swisspush/redisques/util/DequeueStatisticCollector.java
+++ b/src/main/java/org/swisspush/redisques/util/DequeueStatisticCollector.java
@@ -11,6 +11,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.util.Collections;
import java.util.Map;
public class DequeueStatisticCollector {
@@ -18,9 +19,11 @@ public class DequeueStatisticCollector {
private final static String DEQUEUE_STATISTIC_DATA = "dequeueStatisticData";
private final static String DEQUEUE_STATISTIC_LOCK_PREFIX = "dequeueStatisticLock.";
private final SharedData sharedData;
+ private final boolean dequeueStatisticEnabled;
- public DequeueStatisticCollector(Vertx vertx) {
+ public DequeueStatisticCollector(Vertx vertx, boolean dequeueStatisticEnabled) {
this.sharedData = vertx.sharedData();
+ this.dequeueStatisticEnabled = dequeueStatisticEnabled;
}
/**
@@ -107,6 +110,10 @@ public Future setDequeueStatistic(final String queueName, final DequeueSta
}
public Future