|
@@ -117,7 +117,7 @@ public class ApiFlowLimitedInterceptor implements HandlerInterceptor {
|
|
try {
|
|
try {
|
|
expression = (String) props.get(apiInfo.getMapping());
|
|
expression = (String) props.get(apiInfo.getMapping());
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
- // ignore
|
|
|
|
|
|
+ LOG.error("error value. key= " + apiInfo.getMapping(), e);
|
|
}
|
|
}
|
|
if (StringUtils.isBlank(expression)) {
|
|
if (StringUtils.isBlank(expression)) {
|
|
return true;
|
|
return true;
|
|
@@ -143,7 +143,19 @@ public class ApiFlowLimitedInterceptor implements HandlerInterceptor {
|
|
int random = RandomUtils.nextInt(100);
|
|
int random = RandomUtils.nextInt(100);
|
|
if (random <= allowedRate) {
|
|
if (random <= allowedRate) {
|
|
double oneMinuteRate = apiStatusInfo.getOneMinuteRate();
|
|
double oneMinuteRate = apiStatusInfo.getOneMinuteRate();
|
|
- if (oneMinuteRate < minCallRate) {
|
|
|
|
|
|
+
|
|
|
|
+ int curMinCallRate = minCallRate;
|
|
|
|
+ String key = "[R]" + apiInfo.getMapping();
|
|
|
|
+ try {
|
|
|
|
+ String value = (String) props.get(key);
|
|
|
|
+ if (StringUtils.isNotBlank(value)) {
|
|
|
|
+ curMinCallRate = Integer.parseInt(value.trim());
|
|
|
|
+ }
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ LOG.error("error value. key= " + key, e);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (oneMinuteRate < curMinCallRate) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
}
|