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

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


@ghubstan commented on this pull request.



> +                                     TimeUnit timeUnit) {
+            log.info("Adding call rate metering definition {}.{} ({}/{}).",
+                    grpcServiceClassName,
+                    methodName,
+                    maxCalls,
+                    StringUtils.chop(timeUnit.name().toLowerCase()));
+            rateMeterConfigs.stream().filter(c -> c.isConfigForGrpcService(grpcServiceClassName))
+                    .findFirst().ifPresentOrElse(
+                    (config) -> config.addMethodCallRateMeter(methodName, maxCalls, timeUnit),
+                    () -> rateMeterConfigs.add(new GrpcServiceRateMeteringConfig(grpcServiceClassName)
+                            .addMethodCallRateMeter(methodName, maxCalls, timeUnit)));
+        }
+
+        public File build() {
+            File tmpFile = serializeRateMeterDefinitions();
+            File configFile = new File("/tmp/ratemeters.json");

It is only supposed to work on *nix but I changed line 233 to
`File configFile = Paths.get(getProperty("java.io.tmpdir"), "ratemeters.json").toFile();`

-- 
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_r547460387
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20201222/2de684f6/attachment.htm>


More information about the bisq-github mailing list