Skip to content

fix: config service override executor service concurrent reconciliation numbers #1484

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.function.Consumer;

import io.fabric8.kubernetes.client.Config;
Expand All @@ -16,7 +17,8 @@ public class ConfigurationServiceOverrider {
private Metrics metrics;
private Config clientConfig;
private Boolean checkCR;
private Integer threadNumber;
private Integer concurrentReconciliationThreads;
private Integer concurrentWorkflowExecutorThreads;
private Cloner cloner;
private Integer timeoutSeconds;
private Boolean closeClientOnStop;
Expand All @@ -40,7 +42,12 @@ public ConfigurationServiceOverrider checkingCRDAndValidateLocalModel(boolean ch
}

public ConfigurationServiceOverrider withConcurrentReconciliationThreads(int threadNumber) {
this.threadNumber = threadNumber;
this.concurrentReconciliationThreads = threadNumber;
return this;
}

public ConfigurationServiceOverrider withConcurrentWorkflowExecutorThreads(int threadNumber) {
this.concurrentWorkflowExecutorThreads = threadNumber;
return this;
}

Expand Down Expand Up @@ -105,7 +112,14 @@ public boolean checkCRDAndValidateLocalModel() {

@Override
public int concurrentReconciliationThreads() {
return threadNumber != null ? threadNumber : original.concurrentReconciliationThreads();
return concurrentReconciliationThreads != null ? concurrentReconciliationThreads
: original.concurrentReconciliationThreads();
}

@Override
public int concurrentWorkflowExecutorThreads() {
return concurrentWorkflowExecutorThreads != null ? concurrentWorkflowExecutorThreads
: original.concurrentWorkflowExecutorThreads();
}

@Override
Expand All @@ -125,13 +139,14 @@ public boolean closeClientOnStop() {

@Override
public ExecutorService getExecutorService() {
return executorService != null ? executorService : original.getExecutorService();
return executorService != null ? executorService
: Executors.newFixedThreadPool(concurrentReconciliationThreads());
}

@Override
public ExecutorService getWorkflowExecutorService() {
return workflowExecutorService != null ? workflowExecutorService
: original.getWorkflowExecutorService();
: Executors.newFixedThreadPool(concurrentWorkflowExecutorThreads());
}

@Override
Expand Down