From 695ed1f869f8554cf1f1d39f28c5f65fd3ee4648 Mon Sep 17 00:00:00 2001 From: AWSHurneyt Date: Fri, 2 Feb 2024 13:21:50 -0800 Subject: [PATCH] Adjusted suspend function calls. Signed-off-by: AWSHurneyt --- .../TransportGetRemoteIndexesAction.kt | 25 +++++++++++-------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetRemoteIndexesAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetRemoteIndexesAction.kt index 30cfc7a85..1110e7a10 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetRemoteIndexesAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportGetRemoteIndexesAction.kt @@ -134,14 +134,16 @@ class TransportGetRemoteIndexesAction @Inject constructor( } val clusterIndexList = mutableListOf() - indexes.forEach { - clusterIndexList.add( - ClusterIndex( - indexName = it, - indexHealth = clusterHealthResponse!!.indices[it]!!.status, - mappings = mappingsResponse?.mappings?.get(it) + if (clusterHealthResponse != null) { + indexes.forEach { + clusterIndexList.add( + ClusterIndex( + indexName = it, + indexHealth = clusterHealthResponse.indices[it]!!.status, + mappings = mappingsResponse?.mappings?.get(it) + ) ) - ) + } } clusterIndexesList.add( @@ -176,9 +178,12 @@ class TransportGetRemoteIndexesAction @Inject constructor( val clusterHealthRequest = ClusterHealthRequest() .indices(*parsedIndexesNames.toTypedArray()) .indicesOptions(IndicesOptions.lenientExpandHidden()) - return targetClient.suspendUntil { - admin().cluster().health(clusterHealthRequest, it) - } + + return client.suspendUntil { targetClient.admin().cluster().health(clusterHealthRequest, it) } + // TODO hurneyt delete +// return targetClient.suspendUntil { +// admin().cluster().health(clusterHealthRequest, it) +// } } private suspend fun getIndexMappings(targetClient: Client, parsedIndexNames: List): GetMappingsResponse {