Skip to content

Commit

Permalink
Fix quarkusio#26885 - improve Redis health check output
Browse files Browse the repository at this point in the history
  • Loading branch information
cescoffier committed Jul 22, 2022
1 parent ffc1411 commit a15b8dd
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import io.quarkus.redis.datasource.ReactiveRedisDataSource;
import io.quarkus.redis.datasource.RedisDataSource;
import io.quarkus.redis.runtime.client.config.RedisConfig;
import io.smallrye.mutiny.TimeoutException;
import io.vertx.mutiny.redis.client.Command;
import io.vertx.mutiny.redis.client.Redis;
import io.vertx.mutiny.redis.client.Request;
Expand Down Expand Up @@ -88,7 +89,12 @@ public HealthCheckResponse call() {
Duration timeout = getTimeout(client.getKey());
Response response = redisClient.send(Request.cmd(Command.PING)).await().atMost(timeout);
builder.up().withData(redisClientName, response.toString());
} catch (TimeoutException e) {
return builder.down().withData("reason", "client [" + client.getKey() + "]: timeout").build();
} catch (Exception e) {
if (e.getMessage() == null) {
return builder.down().withData("reason", "client [" + client.getKey() + "]: " + e).build();
}
return builder.down().withData("reason", "client [" + client.getKey() + "]: " + e.getMessage()).build();
}
}
Expand Down

0 comments on commit a15b8dd

Please sign in to comment.