Fix typo & Code optimization (#512)

* Fix typo & Code optimization

* update changelog
pull/521/head
DerekYRC 2 years ago committed by GitHub
parent f736d6b568
commit 3cb2e8fe6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,3 +15,4 @@
- [test: add loadbalancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/485) - [test: add loadbalancer unit test](https://github.com/Tencent/spring-cloud-tencent/pull/485)
- [Bugfix: update byte-buddy scope test to compile](https://github.com/Tencent/spring-cloud-tencent/pull/498) - [Bugfix: update byte-buddy scope test to compile](https://github.com/Tencent/spring-cloud-tencent/pull/498)
- [Fix the code analysis error.](https://github.com/Tencent/spring-cloud-tencent/pull/500) - [Fix the code analysis error.](https://github.com/Tencent/spring-cloud-tencent/pull/500)
- [Fix typo & Code optimization](https://github.com/Tencent/spring-cloud-tencent/pull/512)

@ -89,7 +89,7 @@ public class PolarisDiscoveryHandler {
* Return all service for given namespace. * Return all service for given namespace.
* @return service list * @return service list
*/ */
public ServicesResponse GetServices() { public ServicesResponse getServices() {
String namespace = polarisDiscoveryProperties.getNamespace(); String namespace = polarisDiscoveryProperties.getNamespace();
GetServicesRequest request = new GetServicesRequest(); GetServicesRequest request = new GetServicesRequest();
request.setNamespace(namespace); request.setNamespace(namespace);

@ -65,10 +65,10 @@ public class PolarisServiceDiscovery {
* @throws PolarisException polarisException * @throws PolarisException polarisException
*/ */
public List<String> getServices() throws PolarisException { public List<String> getServices() throws PolarisException {
if (CollectionUtils.isEmpty(polarisDiscoveryHandler.GetServices().getServices())) { if (CollectionUtils.isEmpty(polarisDiscoveryHandler.getServices().getServices())) {
return Collections.emptyList(); return Collections.emptyList();
} }
return polarisDiscoveryHandler.GetServices().getServices().stream() return polarisDiscoveryHandler.getServices().getServices().stream()
.map(ServiceInfo::getService).collect(Collectors.toList()); .map(ServiceInfo::getService).collect(Collectors.toList());
} }
} }

@ -20,9 +20,9 @@ package com.tencent.cloud.polaris.ratelimit.config;
import com.tencent.cloud.polaris.context.ConditionalOnPolarisEnabled; import com.tencent.cloud.polaris.context.ConditionalOnPolarisEnabled;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
/** /**
* Properties auto configuration of rate limit. * Properties auto configuration of rate limit.
@ -31,7 +31,7 @@ import org.springframework.context.annotation.Import;
*/ */
@Configuration(proxyBeanMethods = false) @Configuration(proxyBeanMethods = false)
@ConditionalOnPolarisEnabled @ConditionalOnPolarisEnabled
@Import({PolarisRateLimitProperties.class}) @EnableConfigurationProperties(PolarisRateLimitProperties.class)
public class PolarisRateLimitPropertiesAutoConfiguration { public class PolarisRateLimitPropertiesAutoConfiguration {
@Bean @Bean

@ -35,7 +35,7 @@ public final class RateLimitConstant {
/** /**
* Info of rate limit. * Info of rate limit.
*/ */
public static String QUOTA_LIMITED_INFO = "The request is deny by rate limit because the throttling threshold is reached"; public static String QUOTA_LIMITED_INFO = "The request is denied by rate limit because the throttling threshold is reached";
/** /**
* The build in label method. * The build in label method.

Loading…
Cancel
Save