problem: fails to add another dshackle upstream if any of blockchain is unsupported

This commit is contained in:
Igor Artamonov
2020-08-31 14:06:26 -04:00
parent 93da68ff49
commit b7de4f0490

View File

@@ -101,6 +101,8 @@ class GrpcUpstreams(
prev?.dispose() prev?.dispose()
subscription subscription
} }
}.doOnError { t ->
log.error("Failed to process update from gRPC upstream $id", t)
} }
return updates return updates
@@ -109,11 +111,16 @@ class GrpcUpstreams(
fun processDescription(value: BlockchainOuterClass.DescribeResponse): Flux<UpstreamChange> { fun processDescription(value: BlockchainOuterClass.DescribeResponse): Flux<UpstreamChange> {
val current = value.chainsList.filter { val current = value.chainsList.filter {
Chain.byId(it.chain.number) != Chain.UNSPECIFIED Chain.byId(it.chain.number) != Chain.UNSPECIFIED
}.map { chainDetails -> }.mapNotNull { chainDetails ->
val chain = Chain.byId(chainDetails.chain.number) try {
val up = getOrCreate(chain) val chain = Chain.byId(chainDetails.chain.number)
(up.upstream as EthereumGrpcUpstream).init(chainDetails) val up = getOrCreate(chain)
up (up.upstream as EthereumGrpcUpstream).init(chainDetails)
up
} catch (e: Throwable) {
log.warn("Skip unsupported upstream ${chainDetails.chain} on $id: ${e.message}")
null
}
} }
val added = current.filter { val added = current.filter {