- set throttled logger timeout for 20 minutes

- set astar chain block time to 1m
- add throttled log to liveness checker
This commit is contained in:
a10zn8
2023-10-25 19:16:54 +04:00
committed by GitHub
parent 8aa89a1945
commit defc0b5a7b
3 changed files with 13 additions and 4 deletions

View File

@@ -628,7 +628,7 @@ chain-settings:
label: Astar zkEVM label: Astar zkEVM
type: eth type: eth
settings: settings:
expected-block-time: 2s expected-block-time: 1m
options: options:
validate-peers: false validate-peers: false
lags: lags:

View File

@@ -8,7 +8,7 @@ class ThrottledLogger {
companion object { companion object {
private val cache = Caffeine.newBuilder() private val cache = Caffeine.newBuilder()
.expireAfterWrite(Duration.ofMinutes(1)) .expireAfterWrite(Duration.ofMinutes(20))
.build<String, Boolean>() .build<String, Boolean>()
fun log(log: Logger, msg: String) { fun log(log: Logger, msg: String) {

View File

@@ -1,5 +1,6 @@
package io.emeraldpay.dshackle.upstream.ethereum package io.emeraldpay.dshackle.upstream.ethereum
import io.emeraldpay.dshackle.ThrottledLogger
import io.emeraldpay.dshackle.upstream.Head import io.emeraldpay.dshackle.upstream.Head
import org.slf4j.LoggerFactory import org.slf4j.LoggerFactory
import reactor.core.publisher.Flux import reactor.core.publisher.Flux
@@ -26,7 +27,11 @@ class HeadLivenessValidator(
if (value) { if (value) {
Pair(acc.first + 1, true) Pair(acc.first + 1, true)
} else { } else {
log.debug("non consecutive blocks in head for $upstreamId") if (log.isDebugEnabled) {
log.debug("non consecutive blocks in head for $upstreamId")
} else {
ThrottledLogger.log(log, "non consecutive blocks in head for $upstreamId")
}
Pair(0, false) Pair(0, false)
} }
}.flatMap { (count, value) -> }.flatMap { (count, value) ->
@@ -40,7 +45,11 @@ class HeadLivenessValidator(
}.timeout( }.timeout(
expectedBlockTime.multipliedBy(CHECKED_BLOCKS_UNTIL_LIVE.toLong() * 2), expectedBlockTime.multipliedBy(CHECKED_BLOCKS_UNTIL_LIVE.toLong() * 2),
Flux.just(false).doOnNext { Flux.just(false).doOnNext {
log.debug("head liveness check broken with timeout in $upstreamId") if (log.isDebugEnabled) {
log.debug("head liveness check broken with timeout in $upstreamId")
} else {
ThrottledLogger.log(log, "head liveness check broken with timeout in $upstreamId")
}
}, },
).repeat().subscribeOn(scheduler) ).repeat().subscribeOn(scheduler)
} }