From 869b10a1bb77397c12e874ed6c71e1eaaf950a03 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser <23085769+hiddenalpha@users.noreply.github.com> Date: Tue, 18 Jun 2024 11:01:04 +0200 Subject: [PATCH 1/2] [SDCISA-16207] Add more error handing for PeriodicSkipScheduler --- .../redisques/scheduling/PeriodicSkipScheduler.java | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/swisspush/redisques/scheduling/PeriodicSkipScheduler.java b/src/main/java/org/swisspush/redisques/scheduling/PeriodicSkipScheduler.java index 848d14c..0f82990 100644 --- a/src/main/java/org/swisspush/redisques/scheduling/PeriodicSkipScheduler.java +++ b/src/main/java/org/swisspush/redisques/scheduling/PeriodicSkipScheduler.java @@ -53,7 +53,16 @@ private void onTrigger(Timer timer) { var fut = p.future(); fut.onSuccess((Void v) -> timer.onTaskDone_()); fut.onFailure(ex -> log.error("This is expected to be UNREACHABLE ({})", timer.dbgHint, ex)); - timer.task.accept(p::complete); + try { + timer.task.accept(p::complete); + } catch (Exception ex) { + if (log.isDebugEnabled()) { + log.debug("Task has failed ({})", timer.dbgHint, ex); + } else { + log.info("Task has failed ({}): {}", timer.dbgHint, ex.getMessage()); + } + p.tryComplete(); + } } private void onTaskDone(Timer timer) { From e097a4b4e827f537994f78a8ac317ed1e7206f90 Mon Sep 17 00:00:00 2001 From: Andreas Fankhauser <23085769+hiddenalpha@users.noreply.github.com> Date: Thu, 20 Jun 2024 13:44:09 +0200 Subject: [PATCH 2/2] Fine-tune logging --- .../redisques/handler/GetQueuesItemsCountHandler.java | 9 +++++++-- .../redisques/util/QueueStatisticsCollector.java | 7 +------ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java b/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java index a2796f0..e595e14 100644 --- a/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java +++ b/src/main/java/org/swisspush/redisques/handler/GetQueuesItemsCountHandler.java @@ -136,8 +136,13 @@ public void handle(AsyncResult handleQueues) { } var obj = new JsonObject().put(STATUS, OK).put(QUEUES, result); long jsonCreateDurationMs = currentTimeMillis() - beginEpchMs; - log.info("Creating JSON with {} entries did block this tread for {}ms", - ctx.queueLengths.length, jsonCreateDurationMs); + if (jsonCreateDurationMs > 10) { + log.info("Creating JSON with {} entries did block this tread for {}ms", + ctx.queueLengths.length, jsonCreateDurationMs); + }else{ + log.debug("Creating JSON with {} entries did block this tread for {}ms", + ctx.queueLengths.length, jsonCreateDurationMs); + } workerPromise.complete(obj); }, false); }).onSuccess((JsonObject json) -> { diff --git a/src/main/java/org/swisspush/redisques/util/QueueStatisticsCollector.java b/src/main/java/org/swisspush/redisques/util/QueueStatisticsCollector.java index 697322f..f41430d 100644 --- a/src/main/java/org/swisspush/redisques/util/QueueStatisticsCollector.java +++ b/src/main/java/org/swisspush/redisques/util/QueueStatisticsCollector.java @@ -522,12 +522,7 @@ Future step2(RequestCtx ctx) { int numQueues = ctx.queueNames.size(); return vertx.executeBlocking(executeBlockingPromise -> { - String fmt1 = "About to perform {} requests to redis just for monitoring"; - if (numQueues > 256) { - log.warn(fmt1, numQueues); - } else { - log.debug(fmt1, numQueues); - } + log.debug("About to perform {} requests to redis just for monitoring", numQueues); long begRedisRequestsEpochMs = currentTimeMillis(); List workerThreadTaskList = new ArrayList<>();