diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt b/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt index 919c2bd91..908b3a004 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt @@ -16,6 +16,7 @@ import org.opensearch.cluster.ClusterStateListener import org.opensearch.cluster.service.ClusterService import org.opensearch.common.lifecycle.LifecycleListener import org.opensearch.common.unit.TimeValue +import org.opensearch.commons.alerting.model.ScheduledJob import org.opensearch.threadpool.Scheduler import org.opensearch.threadpool.ThreadPool import org.opensearch.transport.client.Client @@ -45,6 +46,8 @@ class DestinationMigrationCoordinator( } override fun clusterChanged(event: ClusterChangedEvent) { + if (!event.indexRoutingTableChanged(ScheduledJob.SCHEDULED_JOBS_INDEX)) return + if (DestinationMigrationUtilService.finishFlag) { logger.info("Reset destination migration process.") scheduledMigration?.cancel()