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 fbb3b1527..a6e083f61 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 @@ -62,8 +62,10 @@ class DestinationMigrationCoordinator( runningLock = false } } else if (!event.localNodeClusterManager()) { - logger.info("Cancelling the migration process.") - scheduledMigration?.cancel() + if (scheduledMigration != null && !scheduledMigration!!.isCancelled) { + logger.info("Cancelling the migration process.") + scheduledMigration?.cancel() + } } }