Skip to content

Commit 688d37c

Browse files
committed
More tuning parameters
1 parent 835f1d6 commit 688d37c

File tree

2 files changed

+24
-6
lines changed

2 files changed

+24
-6
lines changed

src/main/java/oracle/kubernetes/operator/Main.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,14 @@ public class Main {
9696
private static final int statusUpdateTimeoutSeconds = (int) readTuningParameter("statusUpdateTimeoutSeconds", 10);
9797
private static final int unchangedCountToDelayStatusRecheck = (int) readTuningParameter("unchangedCountToDelayStatusRecheck", 10);
9898
private static final long initialShortDelay = readTuningParameter("initialShortDelay", 3);
99-
private static final long eventualLongDelay = readTuningParameter("eventualLongDelay", 30);
99+
private static final long eventualLongDelay = readTuningParameter("eventualLongDelay", 30);
100+
101+
static {
102+
int callRequestLimit = (int) readTuningParameter("callRequestLimit", 500);
103+
int callMaxRetryCount = (int) readTuningParameter("callMaxRetryCount", 5);
104+
int callTimeoutSeconds = (int) readTuningParameter("callTimeoutSeconds", 10);
105+
CallBuilder.setTuningParameters(callRequestLimit, callMaxRetryCount, callTimeoutSeconds);
106+
}
100107

101108
private static final ConcurrentMap<String, Boolean> initialized = new ConcurrentHashMap<>();
102109
private static final AtomicBoolean stopping = new AtomicBoolean(false);

src/main/java/oracle/kubernetes/operator/helpers/CallBuilder.java

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,20 @@
4848
*
4949
*/
5050
public class CallBuilder {
51-
static final String RESPONSE_COMPONENT_NAME = "response";
52-
5351
private static final LoggingFacade LOGGER = LoggingFactory.getLogger("Operator", "Operator");
5452

53+
static final String RESPONSE_COMPONENT_NAME = "response";
54+
55+
private static int callRequestLimit = 500;
56+
private static int callMaxRetryCount = 5;
57+
private static int callTimeoutSeconds = 10;
58+
59+
public static void setTuningParameters(int callRequestLimit, int callMaxRetryCount, int callTimeoutSeconds) {
60+
CallBuilder.callRequestLimit = callRequestLimit;
61+
CallBuilder.callMaxRetryCount = callMaxRetryCount;
62+
CallBuilder.callTimeoutSeconds = callTimeoutSeconds;
63+
}
64+
5565
/**
5666
* HTTP status code for "Not Found"
5767
*/
@@ -65,9 +75,10 @@ public class CallBuilder {
6575
public String fieldSelector = "";
6676
public Boolean includeUninitialized = Boolean.FALSE;
6777
public String labelSelector = "";
68-
public Integer limit = 500;
78+
public Integer limit = callRequestLimit;
6979
public String resourceVersion = "";
70-
public Integer timeoutSeconds = 30;
80+
public Integer timeoutSeconds = callTimeoutSeconds;
81+
public Integer maxRetryCount = callMaxRetryCount;
7182
public Boolean watch = Boolean.FALSE;
7283
public Boolean exact = Boolean.FALSE;
7384
public Boolean export = Boolean.FALSE;
@@ -1446,7 +1457,7 @@ public NextAction doPotentialRetry(Step conflictStep, Packet packet, ApiExceptio
14461457
}
14471458

14481459
NextAction na = new NextAction();
1449-
if (statusCode == 0 && retryCount <= 2) {
1460+
if (statusCode == 0 && retryCount <= maxRetryCount) {
14501461
na.invoke(retryStep, packet);
14511462
} else {
14521463
LOGGER.info(MessageKeys.ASYNC_RETRY, String.valueOf(waitTime));

0 commit comments

Comments
 (0)