Re #7: Added default value to maxRequestsInFlight, and check in the builder if it is > 0 (or else exception is thrown).

This commit is contained in:
tomasz.kowalczewski committed 2021-01-16 20:47:18 +01:00
1 parent a6e63cb6b9
commit 6b0ec58497
2 files changed
+6 -2

No files matched your search

@@ -58,7 +58,7 @@ public class LokiAppenderBuilder<B extends LokiAppenderBuilder<B>> extends Abstr
private String logLevelLabel;
@PluginBuilderAttribute
private int maxRequestsInFlight;
private int maxRequestsInFlight = 100;
@PluginElement("Headers")
private Header[] headers;
@@ -7,7 +7,7 @@ public class ClientConfigurationBuilder {
public static final int DEFAULT_CONNECT_TIMEOUT_MILLIS = 5_000;
public static final int DEFAULT_REQUEST_TIMEOUT_MILLIS = 60_000;
public static final int DEFAULT_MAX_REQUESTS_IN_FLIGHT = 10;
public static final int DEFAULT_MAX_REQUESTS_IN_FLIGHT = 100;
public static final int DEFAULT_MAX_RETRIES = 0;
@@ -57,6 +57,10 @@ public class ClientConfigurationBuilder {
}
public ClientConfiguration build() {
if (maxRequestsInFlight <= 0) {
throw new IllegalArgumentException("Property maxRequestsInFlight must be greater than 0");
}
return new ClientConfiguration(
logEndpoint,
host,