Skip to content

Commit

Permalink
Switch back to thread for execution of the cluster configuration to k…
Browse files Browse the repository at this point in the history
…eep security manager state

Signed-off-by: Peter Nied <[email protected]>
  • Loading branch information
peternied committed Jan 4, 2024
1 parent 9442ad4 commit 3fe1ddb
Showing 1 changed file with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -314,9 +314,14 @@ private void waitForSecurityIndexToBeAtLeastYellow() {

public CompletableFuture<Boolean> initOnNodeStart() {
final boolean installDefaultConfig = settings.getAsBoolean(ConfigConstants.SECURITY_ALLOW_DEFAULT_INIT_SECURITYINDEX, false);
final Supplier<CompletableFuture<Boolean>> startInitialization = () -> CompletableFuture.runAsync(
() -> initalizeClusterConfiguration(installDefaultConfig)
).thenAccept(initalizeConfigTask::complete).thenApply(result -> installDefaultConfig);

final Supplier<CompletableFuture<Boolean>> startInitialization = () -> {
new Thread(() -> {
initalizeClusterConfiguration(installDefaultConfig);
initalizeConfigTask.complete(null);
}).start();
return initalizeConfigTask.thenApply(result -> installDefaultConfig);
};
try {
if (installDefaultConfig) {
LOGGER.info("Will attempt to create index {} and default configs if they are absent", securityIndex);
Expand Down

0 comments on commit 3fe1ddb

Please sign in to comment.