diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCE.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCE.java index 272cce9501..95d7ff3e25 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCE.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCE.java @@ -1,13 +1,7 @@ package com.appsmith.server.services.ce; -import org.springframework.boot.actuate.health.Health; import reactor.core.publisher.Mono; public interface HealthCheckServiceCE { - Mono getHealth(); - - Mono getRedisHealth(); - - Mono getMongoHealth(); } diff --git a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCEImpl.java b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCEImpl.java index 4c3bc7242f..e1059fd389 100644 --- a/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCEImpl.java +++ b/app/server/appsmith-server/src/main/java/com/appsmith/server/services/ce/HealthCheckServiceCEImpl.java @@ -6,7 +6,6 @@ import lombok.extern.slf4j.Slf4j; import org.springframework.boot.actuate.data.mongo.MongoReactiveHealthIndicator; import org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator; import org.springframework.boot.actuate.health.Health; -import org.springframework.boot.actuate.health.Status; import org.springframework.data.mongodb.core.ReactiveMongoTemplate; import org.springframework.data.redis.connection.ReactiveRedisConnectionFactory; import reactor.core.publisher.Mono; @@ -30,11 +29,10 @@ public class HealthCheckServiceCEImpl implements HealthCheckServiceCE { @Override public Mono getHealth() { - return Mono.zip(getRedisHealth(), getMongoHealth()).map(tuple -> "All systems are Up"); + return Mono.when(getRedisHealth(), getMongoHealth()).thenReturn("All systems are up"); } - @Override - public Mono getRedisHealth() { + private Mono getRedisHealth() { Function healthTimeout = error -> { log.warn("Redis health check timed out: {}", error.getMessage()); return new AppsmithException(AppsmithError.HEALTHCHECK_TIMEOUT, "Redis"); @@ -47,8 +45,7 @@ public class HealthCheckServiceCEImpl implements HealthCheckServiceCE { .onErrorMap(TimeoutException.class, healthTimeout); } - @Override - public Mono getMongoHealth() { + private Mono getMongoHealth() { Function healthTimeout = error -> { log.warn("MongoDB health check timed out: {}", error.getMessage()); return new AppsmithException(AppsmithError.HEALTHCHECK_TIMEOUT, "Mongo"); @@ -60,11 +57,4 @@ public class HealthCheckServiceCEImpl implements HealthCheckServiceCE { .timeout(Duration.ofSeconds(1)) .onErrorMap(TimeoutException.class, healthTimeout); } - - private boolean isUp(Health health) { - if (Status.UP.equals(health.getStatus())) { - return Boolean.TRUE; - } - return Boolean.FALSE; - } }