From ce4e3985f79b7db995743c90428c5b22abee5760 Mon Sep 17 00:00:00 2001 From: Nishant Bhagat Date: Wed, 18 Oct 2023 15:13:37 -0500 Subject: [PATCH] Fix index refresh issue Signed-off-by: Nishant Bhagat --- .../opensearch/notifications/index/NotificationConfigIndex.kt | 2 +- .../integtest/config/ChimeNotificationConfigCrudIT.kt | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt index bc63de0e..b742c628 100644 --- a/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt +++ b/notifications/notifications/src/main/kotlin/org/opensearch/notifications/index/NotificationConfigIndex.kt @@ -182,7 +182,7 @@ internal object NotificationConfigIndex : ConfigOperations { */ override suspend fun createNotificationConfig(configDoc: NotificationConfigDoc, id: String?): String? { createIndex() - val indexRequest = IndexRequest(INDEX_NAME) + val indexRequest = IndexRequest(INDEX_NAME).setRefreshPolicy(WriteRequest.RefreshPolicy.IMMEDIATE) .source(configDoc.toXContent()) .create(true) if (id != null) { diff --git a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt index 3707bb83..bc6f0708 100644 --- a/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt +++ b/notifications/notifications/src/test/kotlin/org/opensearch/integtest/config/ChimeNotificationConfigCrudIT.kt @@ -41,7 +41,6 @@ class ChimeNotificationConfigCrudIT : PluginRestTestCase() { """.trimIndent() val configId = createConfigWithRequestJsonString(createRequestJsonString) Assert.assertNotNull(configId) - Thread.sleep(1000) // Get chime notification config