fix: beautify ServicesEagerLoadSmartLifecycle logging. (#1774)

Signed-off-by: Haotian Zhang <928016560@qq.com>
Fishtail 6 days ago committed by Haotian Zhang
parent 56d7126ab8
commit 33bbc5df69

@ -34,3 +34,4 @@
- [fix:fix NPE when rate-limiting with null value.](https://github.com/Tencent/spring-cloud-tencent/pull/1763)
- [fix: get source service name from upstream application meta in getServerPreSpanAttributes & set custom tag in current server span in tsf.](https://github.com/Tencent/spring-cloud-tencent/pull/1767)
- [feat:support body store switch.](https://github.com/Tencent/spring-cloud-tencent/pull/1771)
- [fix: beautify ServicesEagerLoadSmartLifecycle logging.](https://github.com/Tencent/spring-cloud-tencent/pull/1774)

@ -44,9 +44,9 @@ public class PolarisEagerLoadAutoConfiguration {
@Bean
@ConditionalOnProperty(name = "spring.cloud.polaris.discovery.eager-load.services.enabled", havingValue = "true", matchIfMissing = true)
public ServicesEagerLoadSmartLifecycle serviceEagerLoadSmartLifecycle(
ApplicationContext applicationContext, @Autowired(required = false) PolarisDiscoveryClient polarisDiscoveryClient,
@Autowired(required = false) PolarisDiscoveryClient polarisDiscoveryClient,
@Autowired(required = false) PolarisReactiveDiscoveryClient polarisReactiveDiscoveryClient) {
return new ServicesEagerLoadSmartLifecycle(applicationContext, polarisDiscoveryClient, polarisReactiveDiscoveryClient);
return new ServicesEagerLoadSmartLifecycle(polarisDiscoveryClient, polarisReactiveDiscoveryClient);
}
}

@ -24,22 +24,18 @@ import com.tencent.cloud.polaris.discovery.reactive.PolarisReactiveDiscoveryClie
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.SmartLifecycle;
public class ServicesEagerLoadSmartLifecycle implements SmartLifecycle {
private static final Logger LOG = LoggerFactory.getLogger(ServicesEagerLoadSmartLifecycle.class);
private final ApplicationContext applicationContext;
private final PolarisDiscoveryClient polarisDiscoveryClient;
private final PolarisReactiveDiscoveryClient polarisReactiveDiscoveryClient;
public ServicesEagerLoadSmartLifecycle(ApplicationContext applicationContext, PolarisDiscoveryClient polarisDiscoveryClient,
public ServicesEagerLoadSmartLifecycle(PolarisDiscoveryClient polarisDiscoveryClient,
PolarisReactiveDiscoveryClient polarisReactiveDiscoveryClient) {
this.applicationContext = applicationContext;
this.polarisDiscoveryClient = polarisDiscoveryClient;
this.polarisReactiveDiscoveryClient = polarisReactiveDiscoveryClient;
}
@ -53,7 +49,7 @@ public class ServicesEagerLoadSmartLifecycle implements SmartLifecycle {
LOG.info("eager-load got services: {}", servicesList);
}
else if (polarisReactiveDiscoveryClient != null) {
polarisReactiveDiscoveryClient.getServices().subscribe(services -> {
polarisReactiveDiscoveryClient.getServices().collectList().subscribe(services -> {
LOG.info("eager-load got services: {}", services);
});
}

Loading…
Cancel
Save