REQ-3345: 添加限流
This commit is contained in:
parent
8483b955b2
commit
97e99dcb3f
@ -68,11 +68,9 @@ public class GroupRateLimiter implements InitializingBean {
|
||||
}
|
||||
|
||||
public void acquire() {
|
||||
long beginMs = System.currentTimeMillis();
|
||||
rateLimiter.acquire();
|
||||
long deltaMs = System.currentTimeMillis() - beginMs;
|
||||
if (deltaMs > 1000)
|
||||
notification.send("{} wait too long to acquire rate limiter: {}ms", name, deltaMs);
|
||||
double seconds = rateLimiter.acquire();
|
||||
if (seconds > 1)
|
||||
notification.send("{} wait too long to acquire rate limiter: {} seconds", name, seconds);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user