override fun onFailure()

in src/main/kotlin/org/opensearch/replication/repository/RemoteClusterRepository.kt [302:318]


                    override fun onFailure(e: java.lang.Exception?) {
                        log.error("Restore of ${store.shardId()} failed due to ${e?.stackTraceToString()}")
                        if (e is NodeDisconnectedException || e is NodeNotConnectedException || e is ConnectTransportException) {
                            log.info("Retrying restore shard for ${store.shardId()}")
                            Thread.sleep(1000) // to get updated leader cluster state
                            launch(Dispatchers.IO + leaderClusterClient.threadPool().coroutineContext()) {
                                restoreShardWithRetries(store, snapshotId, indexId, snapshotShardId,
                                        recoveryState, listener, ::restoreShardUsingMultiChunkTransfer, log = log)
                            }
                        } else {
                            log.error("Not retrying restore shard for ${store.shardId()}")
                            store.decRef()
                            releaseLeaderResources(restoreUUID, leaderShardNode, leaderShardId, followerShardId, followerIndexName)
                            listener.onFailure(e)
                        }

                    }