From d132b193186e27a755cd0560361b7b8e0b3467da Mon Sep 17 00:00:00 2001 From: Florian Spiess Date: Wed, 15 Mar 2023 13:35:58 +0100 Subject: [PATCH] Fix log message claiming connected to Cottontail even when not connected (#367) --- .../cineast/core/db/cottontaildb/CottontailWrapper.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailWrapper.java b/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailWrapper.java index 2c638a117..c946ae295 100644 --- a/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailWrapper.java +++ b/cineast-core/src/main/java/org/vitrivr/cineast/core/db/cottontaildb/CottontailWrapper.java @@ -32,7 +32,9 @@ public CottontailWrapper(String host, int port) { this.client = new SimpleClient(sharedChannel(host, port)); boolean pingSuccessful = this.client.ping(); watch.stop(); - if (!pingSuccessful) { + if (pingSuccessful) { + LOGGER.info("Connected to Cottontail DB in {} ms at {}:{}", watch.getTime(TimeUnit.MILLISECONDS), host, port); + } else { LOGGER.warn("Could not ping Cottontail DB instance at {}:{}", host, port); } } @@ -72,7 +74,6 @@ private static ManagedChannel sharedChannel(String host, int port) { * @return {@link ManagedChannel} */ private static ManagedChannel createChannel(String host, int port) { - final StopWatch watch = StopWatch.createStarted(); LOGGER.debug("Starting to connect to Cottontail DB at {}:{}", host, port); final NettyChannelBuilder builder = NettyChannelBuilder.forAddress(host, port).usePlaintext(); final ManagedChannel channel = builder.build(); @@ -80,8 +81,6 @@ private static ManagedChannel createChannel(String host, int port) { LOGGER.info("Closing connection to Cottontail DB."); channel.shutdownNow(); })); - watch.stop(); - LOGGER.info("Connected to Cottontail DB in {} ms at {}:{}", watch.getTime(TimeUnit.MILLISECONDS), host, port); return channel; }