Fix archive detection (#561)

This commit is contained in:
KirillPamPam
2024-09-05 11:40:42 +04:00
committed by GitHub
parent 6942cc637d
commit eb72a43216
5 changed files with 36 additions and 5 deletions

View File

@@ -25,7 +25,7 @@ class Defaults {
const val maxMetadataSize = 16384
val timeout: Duration = Duration.ofSeconds(60)
val timeoutInternal: Duration = timeout.dividedBy(4)
val internalCallsTimeout = Duration.ofSeconds(3)
val internalCallsTimeout = Duration.ofSeconds(5)
val retryConnection: Duration = Duration.ofSeconds(10)
val grpcServerKeepAliveTime: Long = 15 // seconds
val grpcServerKeepAliveTimeout: Long = 5

View File

@@ -19,11 +19,14 @@ class EthereumUpstreamSettingsDetector(
private val chain: Chain,
) : BasicEthUpstreamSettingsDetector(_upstream) {
private val blockNumberReader = EthereumArchiveBlockNumberReader(upstream.getIngressReader())
private val notArchived = upstream
.getLabels()
.find { it.getOrDefault("archive", "") == "false" } != null
override fun internalDetectLabels(): Flux<Pair<String, String>> {
return Flux.merge(
detectNodeType(),
detectArchiveNode(),
detectArchiveNode(notArchived),
detectGasLabels(),
)
}
@@ -88,8 +91,8 @@ class EthereumUpstreamSettingsDetector(
}
}
private fun detectArchiveNode(): Mono<Pair<String, String>> {
if (upstream.getLabels().firstOrNull { it.getOrDefault("archive", "") == "false" } != null) {
private fun detectArchiveNode(notArchived: Boolean): Mono<Pair<String, String>> {
if (notArchived) {
return Mono.empty()
}
return Mono.zip(

View File

@@ -38,7 +38,7 @@ class AggregatedUpstreamValidator(
.timeout(internalCallsTimeout)
.onErrorResume {
log.error("Error during upstream validation for {}, reason - {}", upstream.getId(), it.message)
Mono.just(ValidateUpstreamSettingsResult.UPSTREAM_FATAL_SETTINGS_ERROR)
Mono.just(ValidateUpstreamSettingsResult.UPSTREAM_SETTINGS_ERROR)
}
}