Skip to content

Commit

Permalink
Address comments from @ikhoon
Browse files Browse the repository at this point in the history
  • Loading branch information
minwoox committed Sep 27, 2024
1 parent 5638880 commit fa46f7b
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ protected void handleXdsResource(String path, String contentAsText, String group
updaters.put(watcherName, updater);
future.handle((kubernetesEndpointGroup, cause) -> {
if (cause != null) {
logger.warn("Unexpected exception while creating a KubernetesEndpointGroup in fetching service",
cause);
// Do not remove the updater from updaters because it can remove the updater that is created
// by the next commit. The updater will be removed only when the file or group is removed.
updater.close();
Expand All @@ -150,7 +152,7 @@ protected void handleXdsResource(String path, String contentAsText, String group
if (endpoints.isEmpty()) {
return;
}
executorService.execute(updater::maybeSchedule);
executorService.execute(() -> updater.maybeSchedule(kubernetesEndpointGroup));
}, true);
return null;
});
Expand Down Expand Up @@ -231,7 +233,7 @@ private static class KubernetesEndpointsUpdater {
this.clusterName = clusterName;
}

void maybeSchedule() {
void maybeSchedule(KubernetesEndpointGroup kubernetesEndpointGroup) {
if (scheduledFuture != null) {
return;
}
Expand All @@ -240,7 +242,6 @@ void maybeSchedule() {
scheduledFuture = executorService.schedule(() -> {
scheduledFuture = null;
// maybeSchedule() is called after the future is completed.
final KubernetesEndpointGroup kubernetesEndpointGroup = kubernetesEndpointGroupFuture.join();
if (kubernetesEndpointGroup.isClosing()) {
return;
}
Expand Down

0 comments on commit fa46f7b

Please sign in to comment.