fix:fix the error capture of rate limit exception.

pull/854/head
Haotian Zhang 3 years ago
parent fdc9509d3c
commit 6ccac03e85

@ -4,3 +4,4 @@
- [docs:Add code coverage blocking.](https://github.com/Tencent/spring-cloud-tencent/pull/836)
- [docs:Add license checker GitHub Action.](https://github.com/Tencent/spring-cloud-tencent/pull/839)
- [refactor:move loadbalancer to discovery module.](https://github.com/Tencent/spring-cloud-tencent/pull/844)
- [fix:fix the error capture of rate limit exception.](https://github.com/Tencent/spring-cloud-tencent/pull/854)

@ -46,15 +46,12 @@ public class BusinessController {
private static final Logger LOG = LoggerFactory.getLogger(BusinessController.class);
private final AtomicInteger index = new AtomicInteger(0);
private final AtomicLong lastTimestamp = new AtomicLong(0);
@Autowired
private RestTemplate restTemplate;
@Value("${spring.application.name}")
private String appName;
private AtomicLong lastTimestamp = new AtomicLong(0);
/**
* Get information.
* @return information
@ -87,6 +84,7 @@ public class BusinessController {
}).start();
}
count.await();
index.set(0);
return builder.toString();
}

@ -44,6 +44,7 @@ import org.springframework.context.ApplicationContextAware;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.lang.NonNull;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.ResponseErrorHandler;
import static com.tencent.cloud.common.constant.ContextConstant.UTF_8;
@ -69,6 +70,9 @@ public class EnhancedRestTemplateReporter extends AbstractPolarisReporterAdapter
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
String[] handlerBeanNames = applicationContext.getBeanNamesForType(ResponseErrorHandler.class);
if (handlerBeanNames.length == 1) {
if (this.delegateHandler == null) {
this.delegateHandler = new DefaultResponseErrorHandler();
}
return;
}

Loading…
Cancel
Save