[bisq-network/bisq] Prevent excessive api calls (#4966)

Stan notifications at github.com
Tue Dec 22 20:25:15 CET 2020


@ghubstan commented on this pull request.



> +    @Getter
+    private boolean isRunning;
+
+    @Nullable
+    private Timer timer;
+
+    public GrpcCallRateMeter(long allowedCallsPerTimeUnit, TimeUnit timeUnit) {
+        this.allowedCallsPerTimeUnit = allowedCallsPerTimeUnit;
+        this.timeUnit = timeUnit;
+    }
+
+    public void start() {
+        if (timer != null)
+            timer.stop();
+
+        timer = UserThread.runPeriodically(() -> callsCount = 0, 1, timeUnit);

I rewrote the rate meter class in commit 01546ad.  There is a running call count over the current time window, instead of using this timer (oops).

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4966#discussion_r547464503
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201222/a3809d4d/attachment.htm>


More information about the bisq-github mailing list