Adjustments in availability determination:
- now isAvailable return true in case upstreams are OK or LAGGING - All upstreams in Filtered API now sorted by status
This commit is contained in:
@@ -65,7 +65,7 @@ abstract class DefaultUpstream(
|
||||
}
|
||||
|
||||
override fun isAvailable(): Boolean {
|
||||
return getStatus() == UpstreamAvailability.OK
|
||||
return getStatus() == UpstreamAvailability.OK || getStatus() == UpstreamAvailability.LAGGING
|
||||
}
|
||||
|
||||
fun onStatus(value: BlockchainOuterClass.ChainStatus) {
|
||||
|
||||
@@ -160,11 +160,11 @@ class FilteredApis(
|
||||
|
||||
override fun subscribe(subscriber: Subscriber<in Upstream>) {
|
||||
// initially try only standard upstreams
|
||||
val first = Flux.fromIterable(primaryUpstreams)
|
||||
val second = Flux.fromIterable(secondaryUpstreams)
|
||||
val first = Flux.fromIterable(primaryUpstreams.sortedBy { it.getStatus().grpcId })
|
||||
val second = Flux.fromIterable(secondaryUpstreams.sortedBy { it.getStatus().grpcId })
|
||||
// if all failed, try both standard and fallback upstreams, repeating in cycle
|
||||
val retries = (0 until (retryLimit - 1)).map { r ->
|
||||
Flux.fromIterable(standardWithFallback)
|
||||
Flux.fromIterable(standardWithFallback.sortedBy { it.getStatus().grpcId })
|
||||
// add a delay to let upstream to restore if it's a temp failure
|
||||
// but delay only start of the check, not between upstreams
|
||||
// i.e. if all upstreams failed -> wait -> check all without waiting in between
|
||||
|
||||
Reference in New Issue
Block a user