Skip to content
Merged
Show file tree
Hide file tree
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 @@ -82,7 +82,7 @@ else if (!discoveryProperties.namespaces().isEmpty()) {
}

LOG.debug(() -> "found services : " + result);
return Flux.defer(() -> Flux.just(result));
return Flux.just(result);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since result is already a computed List<ServiceInstance>, there is no need to defer

}

private void addMappedService(KubernetesServiceInstanceMapper<V1Service> mapper, List<ServiceInstance> services,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.springframework.cloud.kubernetes.fabric8.discovery.reactive;

import java.util.Objects;

import io.fabric8.kubernetes.client.KubernetesClient;
import reactor.core.publisher.Flux;
import reactor.core.scheduler.Schedulers;
Expand All @@ -25,7 +27,6 @@
import org.springframework.cloud.kubernetes.commons.discovery.KubernetesDiscoveryProperties;
import org.springframework.cloud.kubernetes.fabric8.discovery.KubernetesClientServicesFunction;
import org.springframework.cloud.kubernetes.fabric8.discovery.KubernetesDiscoveryClient;
import org.springframework.util.Assert;

/**
* Kubernetes implementation of {@link ReactiveDiscoveryClient}. Currently relies on the
Expand All @@ -50,7 +51,7 @@ public String description() {

@Override
public Flux<ServiceInstance> getInstances(String serviceId) {
Assert.notNull(serviceId, "[Assertion failed] - the object argument must not be null");
Objects.requireNonNull(serviceId, "serviceId must not be null");
return Flux.defer(() -> Flux.fromIterable(kubernetesDiscoveryClient.getInstances(serviceId)))
.subscribeOn(Schedulers.boundedElastic());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ else if (!discoveryProperties.namespaces().isEmpty()) {
}

LOG.debug(() -> "found services : " + result);
return Flux.defer(() -> Flux.just(result));
return Flux.just(result);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, no need to defer

}

private void addMappedService(KubernetesServiceInstanceMapper<Service> mapper, List<ServiceInstance> services,
Expand Down
Loading