Skip to content

Commit

Permalink
#176 applied feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mcweba committed Apr 2, 2024
1 parent 30a41f4 commit 4e0bec7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions src/main/java/org/swisspush/reststorage/redis/RedisMonitor.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;

import static java.util.Collections.emptyList;

public class RedisMonitor {
private final Vertx vertx;
Expand Down Expand Up @@ -47,11 +46,11 @@ public RedisMonitor(Vertx vertx, RedisProvider redisProvider, String expirableKe

public void start() {
timer = vertx.setPeriodic(periodMs, timer -> redisProvider.redis().onSuccess(redisAPI -> {
redisAPI.info(new ArrayList<>()).onComplete(event -> {
redisAPI.info(emptyList()).onComplete(event -> {
if (event.succeeded()) {
collectMetrics(event.result().toBuffer());
} else {
log.warn("Cannot collect INFO from redis");
log.warn("Cannot collect INFO from redis", event.cause());

Check warning on line 53 in src/main/java/org/swisspush/reststorage/redis/RedisMonitor.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/swisspush/reststorage/redis/RedisMonitor.java#L53

Added line #L53 was not covered by tests
}
});

Expand All @@ -60,7 +59,7 @@ public void start() {
long value = reply.result().toLong();
publisher.publishMetric("expirable", value);
} else {
log.warn("Cannot collect zcard from redis for key {}", expirableKey);
log.warn("Cannot collect zcard from redis for key {}", expirableKey, reply.cause());

Check warning on line 62 in src/main/java/org/swisspush/reststorage/redis/RedisMonitor.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/swisspush/reststorage/redis/RedisMonitor.java#L59-L62

Added lines #L59 - L62 were not covered by tests
}
});

Check warning on line 64 in src/main/java/org/swisspush/reststorage/redis/RedisMonitor.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/swisspush/reststorage/redis/RedisMonitor.java#L64

Added line #L64 was not covered by tests

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public static String loadResource(String resourceName, boolean exceptionWhenNotF
URL url = Resources.getResource(resourceName);
return Resources.toString(url, Charsets.UTF_8);
} catch (Exception e) {
log.error("Error loading resource '"+resourceName+"'", e);
log.error("Error loading resource '{}'", resourceName, e);

Check warning on line 41 in src/main/java/org/swisspush/reststorage/util/ResourcesUtils.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/swisspush/reststorage/util/ResourcesUtils.java#L40-L41

Added lines #L40 - L41 were not covered by tests
if(exceptionWhenNotFound){
throw new RuntimeException("Error loading required resource '"+resourceName+"'");

Check warning on line 43 in src/main/java/org/swisspush/reststorage/util/ResourcesUtils.java

View check run for this annotation

Codecov / codecov/patch

src/main/java/org/swisspush/reststorage/util/ResourcesUtils.java#L43

Added line #L43 was not covered by tests
}
Expand Down

0 comments on commit 4e0bec7

Please sign in to comment.