Ignore archive labels set manually (#471)

* Ignore archive labels set manually

* not check archive if archive label set to false
This commit is contained in:
Anton
2024-05-08 14:24:35 +03:00
committed by GitHub
parent 289dae92a2
commit 72c6b9dd15
2 changed files with 8 additions and 2 deletions

View File

@@ -43,12 +43,15 @@ class EthereumUpstreamSettingsDetector(
}
private fun detectArchiveNode(): Mono<Pair<String, String>> {
if (upstream.getLabels().firstOrNull { it.getOrDefault("archive", "") == "false" } != null) {
return Mono.empty()
}
return Mono.zip(
blockNumberReader.readEarliestBlock(chain).flatMap { haveBalance(it) },
blockNumberReader.readArchiveBlock().flatMap { haveBalance(it) },
)
.map { "archive" to "true" }
.onErrorResume { Mono.empty() }
.onErrorResume { Mono.just("archive" to "false") }
}
private fun haveBalance(blockNumber: String): Mono<ByteArray> {