Просмотр исходного кода

- Adjust init() conditions placement

LuqmanHakim-Grune 4 лет назад
Родитель
Сommit
aebc6f9634
1 измененных файлов с 4 добавлено и 3 удалено
  1. 4 3
      packages/app/src/server/service/search-delegator/elasticsearch.ts

+ 4 - 3
packages/app/src/server/service/search-delegator/elasticsearch.ts

@@ -147,10 +147,11 @@ class ElasticsearchDelegator implements SearchDelegator<Data> {
   }
 
   async init() {
-    if (!this.isElasticsearchReindexOnBoot) {
-      return this.normalizeIndices(); // call normalizeIndices() only
+    const normalizeIndices = await this.normalizeIndices();
+    if (this.isElasticsearchReindexOnBoot) {
+      return this.rebuildIndex();
     }
-    return this.rebuildIndex(); // rebuildIndex() will call normalizeIndeces() in the end of rebuild process
+    return normalizeIndices;
   }
 
   /**