diff --git a/src/HealthChecks.Redis/HealthChecks.Redis.csproj b/src/HealthChecks.Redis/HealthChecks.Redis.csproj index 6752defc10..79b7b7622b 100644 --- a/src/HealthChecks.Redis/HealthChecks.Redis.csproj +++ b/src/HealthChecks.Redis/HealthChecks.Redis.csproj @@ -9,7 +9,7 @@ - + diff --git a/src/HealthChecks.Redis/RedisHealthCheck.cs b/src/HealthChecks.Redis/RedisHealthCheck.cs index c14f88438d..8e02cb143c 100644 --- a/src/HealthChecks.Redis/RedisHealthCheck.cs +++ b/src/HealthChecks.Redis/RedisHealthCheck.cs @@ -63,6 +63,8 @@ public async Task CheckHealthAsync(HealthCheckContext context } catch (Exception ex) { + _connections.TryRemove(_redisConnectionString, out var connection); + connection?.Dispose(); return new HealthCheckResult(context.Registration.FailureStatus, exception: ex); } }