You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2022/10/11 01:49:54 UTC

[GitHub] [cassandra-sidecar] frankgh opened a new pull request, #39: CASSANDRASC-45: Delegate methods to the RateLimiter

frankgh opened a new pull request, #39:
URL: https://github.com/apache/cassandra-sidecar/pull/39

   Sidecar offers a `SidecarRateLimiter` class that internally uses the `com.google.common.util.concurrent.RateLimiter`. In this commit, we  expose public methods of the `RateLimiter` class using the delegate pattern. These methods will allow us to tweak the settings of the `RateLimiter` that are available to us


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra-sidecar] dineshjoshi commented on a diff in pull request #39: CASSANDRASC-45: Delegate methods to the RateLimiter

Posted by GitBox <gi...@apache.org>.
dineshjoshi commented on code in PR #39:
URL: https://github.com/apache/cassandra-sidecar/pull/39#discussion_r997519393


##########
src/main/java/com/google/common/util/concurrent/SidecarRateLimiter.java:
##########
@@ -51,4 +57,73 @@ public boolean tryAcquire()
     {
         return this.rateLimiter.tryAcquire();
     }
+
+    /**
+     * Updates the stable rate of the internal {@code RateLimiter}, that is, the {@code permitsPerSecond}
+     * argument provided in the factory method that constructed the {@code RateLimiter}.
+     *
+     * @param permitsPerSecond the new stable rate of this {@code RateLimiter}
+     * @throws IllegalArgumentException if {@code permitsPerSecond} is negative or zero
+     */
+    public void setRate(double permitsPerSecond)

Review Comment:
   `setRate(double permitsPerSecond) -> rate(double permitsPerSecond)`



##########
src/main/java/com/google/common/util/concurrent/SidecarRateLimiter.java:
##########
@@ -51,4 +57,73 @@ public boolean tryAcquire()
     {
         return this.rateLimiter.tryAcquire();
     }
+
+    /**
+     * Updates the stable rate of the internal {@code RateLimiter}, that is, the {@code permitsPerSecond}
+     * argument provided in the factory method that constructed the {@code RateLimiter}.
+     *
+     * @param permitsPerSecond the new stable rate of this {@code RateLimiter}
+     * @throws IllegalArgumentException if {@code permitsPerSecond} is negative or zero
+     */
+    public void setRate(double permitsPerSecond)
+    {
+        this.rateLimiter.setRate(permitsPerSecond);
+    }
+
+    public void doSetRate(double permitsPerSecond, long nowMicros)
+    {
+        rateLimiter.doSetRate(permitsPerSecond, nowMicros);
+    }
+
+    public double getRate()

Review Comment:
   `double getRate() -> double rate()`



-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra-sidecar] yifan-c closed pull request #39: CASSANDRASC-45: Delegate methods to the RateLimiter

Posted by GitBox <gi...@apache.org>.
yifan-c closed pull request #39: CASSANDRASC-45: Delegate methods to the RateLimiter
URL: https://github.com/apache/cassandra-sidecar/pull/39


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org


[GitHub] [cassandra-sidecar] frankgh commented on pull request #39: CASSANDRASC-45: Delegate methods to the RateLimiter

Posted by GitBox <gi...@apache.org>.
frankgh commented on PR #39:
URL: https://github.com/apache/cassandra-sidecar/pull/39#issuecomment-1281562223

   > Wondering if there is a non-blocking rate limiter library alternative?
   
   No idea, but it'd be a good idea to look into that. I will take this up as some research


-- 
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: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org