fixed head subscription recovery

This commit is contained in:
Maxksim Fomenkov
2022-10-06 10:57:24 +03:00
parent d8efbcff47
commit 8c0d3faadd
2 changed files with 4 additions and 2 deletions

View File

@@ -104,6 +104,8 @@ class GrpcHead(
blocks = blocks.onErrorContinue { err, _ ->
log.error("Head subscription error. ${err.javaClass.name}:${err.message}", err)
}.doOnNext{
log.info("Received block ${it.height}")
}
headSubscription = super.follow(blocks)

View File

@@ -44,7 +44,7 @@ import org.apache.commons.lang3.exception.ExceptionUtils
import org.slf4j.LoggerFactory
import reactor.core.Disposable
import reactor.core.publisher.Flux
import java.net.ConnectException
import java.io.IOException
import java.time.Duration
import java.util.concurrent.atomic.AtomicReference
import java.util.concurrent.locks.ReentrantLock
@@ -92,7 +92,7 @@ class GrpcUpstreams(
.flatMap {
client.describe(BlockchainOuterClass.DescribeRequest.newBuilder().build())
}.onErrorContinue { t, _ ->
if (ExceptionUtils.indexOfType(t, ConnectException::class.java) >= 0) {
if (ExceptionUtils.indexOfType(t, IOException::class.java) >= 0) {
log.warn("gRPC upstream $host:$port is unavailable. (${t.javaClass}: ${t.message})")
known.values.forEach {
it.setStatus(UpstreamAvailability.UNAVAILABLE)