Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRAFT : Handling HTTP Node Data Source failure when service registry has never been refreshed #39

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import io.appform.ranger.core.model.ServiceRegistry;
import io.appform.ranger.core.signals.Signal;
import io.appform.ranger.core.util.Exceptions;
import java.util.Collections;
import java.util.Objects;
import lombok.extern.slf4j.Slf4j;
import lombok.val;

Expand Down Expand Up @@ -138,8 +140,17 @@ private void updateRegistry() throws InterruptedException {
serviceRegistry.updateNodes(nodeList);
}
else {
log.warn("Empty list returned from node data source. We are in a weird state. Keeping old list for {}",
serviceRegistry.getService().getServiceName());
// if existing node list is null or empty, just refresh it with empty list again
// to set the atomic boolean flag : refreshed as true
if(Objects.isNull(serviceRegistry.nodeList()) || serviceRegistry.nodeList().isEmpty()){
log.debug("Empty list returned from node data source. Old list for {} was empty and refreshing it again with empty list",
serviceRegistry.getService().getServiceName());
serviceRegistry.updateNodes(Collections.emptyList());
} else {
// if existing node list is not null or not empty, retain it as it is
log.warn("Empty list returned from node data source. We are in a weird state. Keeping old list for {}",
serviceRegistry.getService().getServiceName());
}
}
}

Expand Down
Loading