Improve test Redis cluster setup and teardown

This commit is contained in:
Chris Eager authored and Chris Eager committed 2024-04-15 15:58:23 -05:00
1 parent 82881c030a
commit 9cad2c6b7d
2 files changed
+13 -5

No files matched your search

@@ -9,6 +9,7 @@ import com.google.common.annotations.VisibleForTesting;
import io.github.resilience4j.circuitbreaker.CallNotPermittedException;
import io.github.resilience4j.circuitbreaker.CircuitBreaker;
import io.github.resilience4j.circuitbreaker.CircuitBreakerConfig;
import io.lettuce.core.RedisNoScriptException;
import io.lettuce.core.protocol.CommandHandler;
import io.lettuce.core.protocol.CompleteableCommand;
import io.lettuce.core.protocol.RedisCommand;
@@ -112,9 +113,10 @@ public class LettuceShardCircuitBreaker implements NettyCustomizer {
command.onComplete((ignored, throwable) -> {
final long durationNanos = System.nanoTime() - startNanos;
if (throwable != null) {
// RedisNoScriptException doesn’t indicate a fault the breaker can protect
if (throwable != null && !(throwable instanceof RedisNoScriptException)) {
breaker.onError(durationNanos, TimeUnit.NANOSECONDS, throwable);
logger.debug("Command completed with error", throwable);
logger.warn("Command completed with error", throwable);
} else {
breaker.onSuccess(durationNanos, TimeUnit.NANOSECONDS);
}