solution: stream updates to blockchain status

This commit is contained in:
Igor Artamonov
2019-07-26 22:29:19 -04:00
parent 7467e19ea0
commit 64e0ac58fd
9 changed files with 143 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
package io.emeraldpay.dshackle.upstream
import io.emeraldpay.dshackle.config.UpstreamsConfig
import io.emeraldpay.grpc.Chain
import org.slf4j.LoggerFactory
import java.io.Closeable
@@ -57,9 +58,9 @@ class ChainUpstreams (
}
fun printStatus() {
var height: Long = -1
var height: Long? = null
try {
height = head!!.getHead().block(Duration.ofSeconds(1))?.number ?: -1
height = head!!.getHead().block(Duration.ofSeconds(1))?.number
} catch (e: IllegalStateException) {
//timout
} catch (e: Exception) {
@@ -70,7 +71,7 @@ class ChainUpstreams (
.map { "${it.key.name}/${it.value.size}" }
.joinToString(",")
log.info("State of ${chain.chainCode}: height=$height, status=$statuses")
log.info("State of ${chain.chainCode}: height=${height ?: '?'}, status=$statuses")
}