SteveYurongSu commented on code in PR #12543:
URL: https://github.com/apache/iotdb/pull/12543#discussion_r1613399624
##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/protocol/IoTDBConnector.java:
##########
@@ -322,6 +350,18 @@ public List<PipeCompressor> getCompressors() {
return compressors;
}
+ public void rateLimitIfNeeded(
+ final String pipeName, final TEndPoint endPoint, final long bytesLength)
{
+ if (pipeName != null && endPointRateLimitBytesPerSecond > 0) {
+ pipeName2EndPointRateLimiterMap
+ .computeIfAbsent(
+ pipeName, endpoint -> new
PipeEndPointRateLimiter(endPointRateLimitBytesPerSecond))
+ .acquire(endPoint, bytesLength);
+ }
+
+ GlobalRateLimiter.acquire(bytesLength);
+ }
+
Review Comment:
TODO: REFACTOR SINGLETON
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]