fix(manager-api-es): Fix non-breaking race condition to initialise ES index
@@ -196,10 +196,12 @@ public class EsStorage implements IStorage, IStorageQuery {
}
// TODO Do we need a loop to wait for all nodes to join the cluster?
Action<JestResult> action = new IndicesExists.Builder(getIndexName()).build();
+ synchronized(EsStorage.class) {
JestResult result = esClient.execute(action);
if (!result.isSucceeded()) {
createIndex(getIndexName());
}
+ }
} catch (Exception e) {
throw new RuntimeException(e);
}
