Skip to content

Commit

Permalink
Merge pull request #220 from swisspost/logging-optimization-next
Browse files Browse the repository at this point in the history
use scan to get the keys
  • Loading branch information
dominik-cnx authored Nov 11, 2024
2 parents 9ad4ad0 + 1bd8e96 commit c4001d7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/main/java/org/swisspush/redisques/RedisQues.java
Original file line number Diff line number Diff line change
Expand Up @@ -430,12 +430,12 @@ private void registerNotExpiredQueueCheck() {
}
String keysPattern = consumersPrefix + "*";
log.debug("RedisQues list not expired consumers keys:");
redisProvider.redis().onSuccess(redisAPI -> redisAPI.keys(keysPattern, keysResult -> {
if (keysResult.failed() || keysResult.result() == null) {
redisProvider.redis().onSuccess(redisAPI -> redisAPI.scan(Arrays.asList("0", "MATCH", keysPattern, "COUNT", "1000"), keysResult -> {
if (keysResult.failed() || keysResult.result() == null || keysResult.result().size() != 2) {
log.error("Unable to get redis keys of consumers", keysResult.cause());
return;
}
Response keys = keysResult.result();
Response keys = keysResult.result().get(1);
if (keys == null || keys.size() == 0) {
log.debug("0 not expired consumers keys found");
return;
Expand All @@ -446,7 +446,7 @@ private void registerNotExpiredQueueCheck() {
log.trace(response.toString());
}
}
log.debug("{} not expired consumers keys found", keys.size());
log.debug("{} not expired consumers keys found, {} keys in myQueues list", keys.size(), myQueues.size());
}))
.onFailure(throwable -> log.error("Redis: Unable to get redis keys of consumers", throwable));
});
Expand Down

0 comments on commit c4001d7

Please sign in to comment.