Skip to content

Commit 2b7404f

Browse files
updated defaultWorkerPoolSize to vCPU count
1 parent 131a2fc commit 2b7404f

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/main/java/com/uid2/operator/Main.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -503,7 +503,7 @@ private static Vertx createVertx() {
503503
? 60 * 1000
504504
: 3600 * 1000;
505505

506-
final int defaultWorkerPoolSize = Math.max(2, (Runtime.getRuntime().availableProcessors() - 2) / 2 + 1);
506+
final int defaultWorkerPoolSize = Math.max(2, Runtime.getRuntime().availableProcessors());
507507
final int workerPoolSize = getEnvInt(Const.Config.DefaultWorkerPoolThreadCountProp, defaultWorkerPoolSize);
508508
LOGGER.info("Creating Vertx with default worker pool size: {}", workerPoolSize);
509509

@@ -657,4 +657,17 @@ private static int getEnvInt(String name, int defaultValue) {
657657
return defaultValue;
658658
}
659659
}
660+
661+
private static boolean getEnvBool(String name, boolean defaultValue) {
662+
String value = System.getenv(name);
663+
if (value == null || value.isEmpty()) {
664+
return defaultValue;
665+
}
666+
try {
667+
return Boolean.parseBoolean(value);
668+
} catch (NumberFormatException e) {
669+
LOGGER.warn("Invalid boolean value for environment variable {}: '{}', using default: {}", name, value, defaultValue);
670+
return defaultValue;
671+
}
672+
}
660673
}

0 commit comments

Comments
 (0)