mirror of
https://github.com/bisq-network/bisq.git
synced 2024-11-19 09:52:23 +01:00
Change long to int, tidy up error msg
This commit is contained in:
parent
2148a4d958
commit
89e2187878
@ -84,11 +84,13 @@ public final class CallRateMeteringInterceptor implements ServerInterceptor {
|
||||
GrpcCallRateMeter rateMeter) {
|
||||
// The derived method name may not be an exact match to CLI's method name.
|
||||
String timeUnitName = StringUtils.chop(rateMeter.getTimeUnit().name().toLowerCase());
|
||||
return format("the maximum allowed number of %s calls (%d/%s) has been exceeded by %d calls",
|
||||
int callCountAboveLimit = rateMeter.getCallsCount() - rateMeter.getAllowedCallsPerTimeUnit();
|
||||
return format("the maximum allowed number of %s calls (%d/%s) has been exceeded by %d call%s",
|
||||
methodName.toLowerCase(),
|
||||
rateMeter.getAllowedCallsPerTimeUnit(),
|
||||
timeUnitName,
|
||||
rateMeter.getCallsCount() - rateMeter.getAllowedCallsPerTimeUnit());
|
||||
callCountAboveLimit,
|
||||
callCountAboveLimit == 1 ? "" : "s");
|
||||
}
|
||||
|
||||
private Optional<Map.Entry<String, GrpcCallRateMeter>> getRateMeterKV(ServerCall<?, ?> serverCall) {
|
||||
|
@ -18,12 +18,12 @@ import static java.lang.String.format;
|
||||
public final class GrpcCallRateMeter {
|
||||
|
||||
@Getter
|
||||
private final long allowedCallsPerTimeUnit;
|
||||
private final int allowedCallsPerTimeUnit;
|
||||
@Getter
|
||||
private final TimeUnit timeUnit;
|
||||
|
||||
@Getter
|
||||
private long callsCount = 0;
|
||||
private int callsCount = 0;
|
||||
|
||||
@Getter
|
||||
private boolean isRunning;
|
||||
@ -31,7 +31,7 @@ public final class GrpcCallRateMeter {
|
||||
@Nullable
|
||||
private Timer timer;
|
||||
|
||||
public GrpcCallRateMeter(long allowedCallsPerTimeUnit, TimeUnit timeUnit) {
|
||||
public GrpcCallRateMeter(int allowedCallsPerTimeUnit, TimeUnit timeUnit) {
|
||||
this.allowedCallsPerTimeUnit = allowedCallsPerTimeUnit;
|
||||
this.timeUnit = timeUnit;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user