Преглед изворни кода

- Adjust init() conditions placement

LuqmanHakim-Grune пре 4 година
родитељ
комит
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;
   }
 
   /**