|
@@ -40,9 +40,7 @@ public class RateLimitUtil {
|
|
|
.build();
|
|
.build();
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
- public boolean acquire(String devAppId, String url) {
|
|
|
|
|
|
|
+ public synchronized boolean acquire(String devAppId, String url) {
|
|
|
URI uri = URI.create(url);
|
|
URI uri = URI.create(url);
|
|
|
String path = uri.getPath();
|
|
String path = uri.getPath();
|
|
|
String limitKey = path.replaceAll("/$", "").replace("/", ":");
|
|
String limitKey = path.replaceAll("/$", "").replace("/", ":");
|
|
@@ -59,5 +57,6 @@ public class RateLimitUtil {
|
|
|
initMap.put(key, true);
|
|
initMap.put(key, true);
|
|
|
}
|
|
}
|
|
|
return redissonClient.getRateLimiter(key).tryAcquire(1, 1, TimeUnit.SECONDS);
|
|
return redissonClient.getRateLimiter(key).tryAcquire(1, 1, TimeUnit.SECONDS);
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|