handle no matching upstreams

This commit is contained in:
Maxksim Fomenkov
2022-09-28 10:54:23 +03:00
parent 2978d5f604
commit b96723f808

View File

@@ -17,6 +17,7 @@
package io.emeraldpay.dshackle.upstream
import io.emeraldpay.dshackle.Global
import io.emeraldpay.dshackle.SilentException
import io.emeraldpay.dshackle.config.UpstreamsConfig
import io.emeraldpay.grpc.Chain
import io.micrometer.core.instrument.DistributionSummary
@@ -156,6 +157,10 @@ class FilteredApis(
}
override fun subscribe(subscriber: Subscriber<in Upstream>) {
if (allUpstreams.none { matcher.matches(it) }) {
Flux.empty<Upstream>().subscribe(subscriber)
return
}
// initially try only standard upstreams
val first = Flux.fromIterable(primaryUpstreams)
val second = Flux.fromIterable(secondaryUpstreams)