From c3727cb9019844d33f0447f8f9d6d66f5c3a3b40 Mon Sep 17 00:00:00 2001 From: Gunnar von der Beck Date: Thu, 28 Sep 2023 10:55:59 +0200 Subject: [PATCH] refactor: minor change in cleanup's exception output in case Redis is unavailable --- .../java/io/zeebe/redis/exporter/RedisExporter.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/exporter/src/main/java/io/zeebe/redis/exporter/RedisExporter.java b/exporter/src/main/java/io/zeebe/redis/exporter/RedisExporter.java index 3753455..18c1c44 100644 --- a/exporter/src/main/java/io/zeebe/redis/exporter/RedisExporter.java +++ b/exporter/src/main/java/io/zeebe/redis/exporter/RedisExporter.java @@ -4,10 +4,7 @@ import io.camunda.zeebe.exporter.api.context.Context; import io.camunda.zeebe.exporter.api.context.Controller; import io.camunda.zeebe.protocol.record.Record; -import io.lettuce.core.RedisClient; -import io.lettuce.core.RedisFuture; -import io.lettuce.core.SetArgs; -import io.lettuce.core.XTrimArgs; +import io.lettuce.core.*; import io.lettuce.core.api.StatefulRedisConnection; import io.zeebe.exporter.proto.RecordTransformer; import io.zeebe.exporter.proto.Schema; @@ -184,6 +181,8 @@ private void trimStreamValues() { } } }); + } catch (RedisCommandTimeoutException | RedisConnectionException ex) { + logger.error("Error during cleanup due to possible Redis unavailability: ", ex.getMessage()); } catch (Exception ex) { logger.error("Error during cleanup", ex); } finally { @@ -226,6 +225,8 @@ private boolean acquireCleanupLock() { } } } + } catch (RedisCommandTimeoutException | RedisConnectionException ex) { + logger.error("Error acquiring cleanup lock due to possible Redis unavailability: ", ex.getMessage()); } catch (Exception ex) { logger.error("Error acquiring cleanup lock", ex); } @@ -235,6 +236,8 @@ private boolean acquireCleanupLock() { private void releaseCleanupLock() { try { redisConnection.sync().del(CLEANUP_LOCK); + } catch (RedisCommandTimeoutException | RedisConnectionException ex) { + logger.error("Error releasing cleanup lock due to possible Redis unavailability: ", ex.getMessage()); } catch (Exception ex) { logger.error("Error releasing cleanup lock", ex); }