From e69e10ac647cfdef20e1fc31614f509b0426da6a Mon Sep 17 00:00:00 2001 From: hongqiaowei Date: Fri, 25 Jun 2021 17:57:02 +0800 Subject: [PATCH] Release v2.2.0-beta4 --- fizz-bootstrap/pom.xml | 2 +- fizz-common/pom.xml | 2 +- fizz-core/pom.xml | 2 +- .../ResourceRateLimitConfigService.java | 38 +++++++++++++++---- fizz-plugin/pom.xml | 2 +- fizz-spring-boot-starter/pom.xml | 2 +- pom.xml | 2 +- 7 files changed, 36 insertions(+), 14 deletions(-) diff --git a/fizz-bootstrap/pom.xml b/fizz-bootstrap/pom.xml index 113dac1..1fdddd3 100644 --- a/fizz-bootstrap/pom.xml +++ b/fizz-bootstrap/pom.xml @@ -12,7 +12,7 @@ com.fizzgate fizz-bootstrap - 2.2.0-beta3 + 2.2.0-beta4 1.8 diff --git a/fizz-common/pom.xml b/fizz-common/pom.xml index c55038a..0f3b5cf 100644 --- a/fizz-common/pom.xml +++ b/fizz-common/pom.xml @@ -5,7 +5,7 @@ fizz-gateway-community com.fizzgate - 2.2.0-beta3 + 2.2.0-beta4 ../pom.xml 4.0.0 diff --git a/fizz-core/pom.xml b/fizz-core/pom.xml index 936b83d..8d6e0d9 100644 --- a/fizz-core/pom.xml +++ b/fizz-core/pom.xml @@ -5,7 +5,7 @@ fizz-gateway-community com.fizzgate - 2.2.0-beta3 + 2.2.0-beta4 ../pom.xml 4.0.0 diff --git a/fizz-core/src/main/java/we/stats/ratelimit/ResourceRateLimitConfigService.java b/fizz-core/src/main/java/we/stats/ratelimit/ResourceRateLimitConfigService.java index 6f046da..60203f9 100644 --- a/fizz-core/src/main/java/we/stats/ratelimit/ResourceRateLimitConfigService.java +++ b/fizz-core/src/main/java/we/stats/ratelimit/ResourceRateLimitConfigService.java @@ -181,13 +181,28 @@ public class ResourceRateLimitConfigService { return resourceRateLimitConfigMap; } + // _global, service, app, ip, ip+service public void getParentsTo(String resource, List parentList) { String app = null, ip = null, node = null, service = null, path = null; ResourceRateLimitConfig c = resourceRateLimitConfigMap.get(resource); if (c == null) { - service = ResourceRateLimitConfig.getService(resource); - if (service != null) { - parentList.add(ResourceRateLimitConfig.NODE_RESOURCE); + node = ResourceRateLimitConfig.getNode(resource); + if (node != null && node.equals(ResourceRateLimitConfig.NODE)) { + } else { + service = ResourceRateLimitConfig.getService(resource); + app = ResourceRateLimitConfig.getApp(resource); + ip = ResourceRateLimitConfig.getIp(resource); + if (service == null) { + parentList.add(ResourceRateLimitConfig.NODE_RESOURCE); + } else { + if (ip == null) { + parentList.add(ResourceRateLimitConfig.NODE_RESOURCE); + } else { + String r = ResourceRateLimitConfig.buildResourceId(null, ip, null, null, null); + parentList.add(r); + parentList.add(ResourceRateLimitConfig.NODE_RESOURCE); + } + } } return; } else { @@ -211,7 +226,8 @@ public class ResourceRateLimitConfigService { ResourceRateLimitConfig.buildResourceIdTo(b, app, null, null, service, null); checkRateLimitConfigAndAddTo(b, parentList); ResourceRateLimitConfig.buildResourceIdTo(b, app, null, null, null, null); - checkRateLimitConfigAndAddTo(b, parentList); + // checkRateLimitConfigAndAddTo(b, parentList); + to(parentList, b); } else if (service != null) { ResourceRateLimitConfig.buildResourceIdTo(b, app, null, null, null, null); checkRateLimitConfigAndAddTo(b, parentList); @@ -221,9 +237,11 @@ public class ResourceRateLimitConfigService { if (ip != null) { if (path != null) { ResourceRateLimitConfig.buildResourceIdTo(b, null, ip, null, service, null); - checkRateLimitConfigAndAddTo(b, parentList); + // checkRateLimitConfigAndAddTo(b, parentList); + to(parentList, b); ResourceRateLimitConfig.buildResourceIdTo(b, null, ip, null, null, null); - checkRateLimitConfigAndAddTo(b, parentList); + // checkRateLimitConfigAndAddTo(b, parentList); + to(parentList, b); } else if (service != null) { ResourceRateLimitConfig.buildResourceIdTo(b, null, ip, null, null, null); checkRateLimitConfigAndAddTo(b, parentList); @@ -232,13 +250,17 @@ public class ResourceRateLimitConfigService { if (path != null) { ResourceRateLimitConfig.buildResourceIdTo(b, null, null, null, service, null); - parentList.add(b.toString()); - b.delete(0, b.length()); + to(parentList, b); } parentList.add(ResourceRateLimitConfig.NODE_RESOURCE); } + private void to(List parentList, StringBuilder b) { + parentList.add(b.toString()); + b.delete(0, b.length()); + } + private void checkRateLimitConfigAndAddTo(StringBuilder resourceStringBuilder, List resourceList) { String r = resourceStringBuilder.toString(); ResourceRateLimitConfig c = resourceRateLimitConfigMap.get(r); diff --git a/fizz-plugin/pom.xml b/fizz-plugin/pom.xml index 4749c02..6ee10a4 100644 --- a/fizz-plugin/pom.xml +++ b/fizz-plugin/pom.xml @@ -5,7 +5,7 @@ fizz-gateway-community com.fizzgate - 2.2.0-beta3 + 2.2.0-beta4 ../pom.xml 4.0.0 diff --git a/fizz-spring-boot-starter/pom.xml b/fizz-spring-boot-starter/pom.xml index de1eea1..3045428 100644 --- a/fizz-spring-boot-starter/pom.xml +++ b/fizz-spring-boot-starter/pom.xml @@ -5,7 +5,7 @@ fizz-gateway-community com.fizzgate - 2.2.0-beta3 + 2.2.0-beta4 ../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index 5270cb8..8f2926e 100644 --- a/pom.xml +++ b/pom.xml @@ -31,7 +31,7 @@ fizz-gateway-community ${project.artifactId} fizz gateway community - 2.2.0-beta3 + 2.2.0-beta4 pom fizz-common