From 265bc666be0be1217d9e3f8d3011b258086f7295 Mon Sep 17 00:00:00 2001 From: Ying Mao Date: Wed, 12 Jan 2022 14:59:13 -0500 Subject: [PATCH] Adding await --- x-pack/plugins/event_log/server/es/init.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/x-pack/plugins/event_log/server/es/init.ts b/x-pack/plugins/event_log/server/es/init.ts index f9aa148ff024d9..d190ab229af98a 100644 --- a/x-pack/plugins/event_log/server/es/init.ts +++ b/x-pack/plugins/event_log/server/es/init.ts @@ -56,7 +56,7 @@ class EsInitializationSteps { this.esContext.logger.error(`error getting existing index templates - ${err.message}`); } - asyncForEach(Object.keys(indexTemplates), async (indexTemplateName: string) => { + await asyncForEach(Object.keys(indexTemplates), async (indexTemplateName: string) => { try { const hidden: string | boolean = indexTemplates[indexTemplateName]?.settings?.index?.hidden; // Check to see if this index template is hidden @@ -93,7 +93,7 @@ class EsInitializationSteps { // should not block the rest of initialization, log the error and move on this.esContext.logger.error(`error getting existing indices - ${err.message}`); } - asyncForEach(Object.keys(indices), async (indexName: string) => { + await asyncForEach(Object.keys(indices), async (indexName: string) => { try { const hidden: string | boolean | undefined = indices[indexName]?.settings?.index?.hidden; @@ -125,7 +125,7 @@ class EsInitializationSteps { // should not block the rest of initialization, log the error and move on this.esContext.logger.error(`error getting existing index aliases - ${err.message}`); } - asyncForEach(Object.keys(indexAliases), async (indexName: string) => { + await asyncForEach(Object.keys(indexAliases), async (indexName: string) => { try { const aliases = indexAliases[indexName]?.aliases; const hasNotHiddenAliases: boolean = Object.keys(aliases).some((alias: string) => {