Fix #1007: Health check api returns unhealthy if there are no users bootstrapped (#1008)

This commit is contained in:
Sriharsha Chintalapani 2021-10-31 20:55:34 -07:00 committed by GitHub
parent d810af815b
commit 9776cec660
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,6 +25,7 @@ import org.openmetadata.catalog.util.EntityUtil;
import java.io.IOException;
import static org.openmetadata.catalog.resources.teams.UserResource.FIELD_LIST;
import static org.openmetadata.catalog.resources.teams.UserResource.LOG;
public class CatalogHealthCheck extends HealthCheck {
private final UserRepository userRepository;
@ -39,9 +40,10 @@ public class CatalogHealthCheck extends HealthCheck {
@Override
protected Result check() throws Exception {
try {
userRepository.listAfter(fields, null, 1, "");
userRepository.listAfter(fields, null, 1, null);
return Result.healthy();
} catch (IOException e) {
LOG.error("Health check error {}", e.getMessage());
return Result.unhealthy(e.getMessage());
}
}