Fix Flux.merge() concurrency limit in SubscribeChainStatus (#792)

This commit is contained in:
Anton
2026-02-06 15:41:04 +03:00
committed by GitHub
parent b375fd34b4
commit 15047c7d26

View File

@@ -25,10 +25,9 @@ class SubscribeChainStatus(
} }
fun chainStatuses(): Flux<BlockchainOuterClass.SubscribeChainStatusResponse> { fun chainStatuses(): Flux<BlockchainOuterClass.SubscribeChainStatusResponse> {
return Flux.merge(
// we need to track not only multistreams with upstreams but all of them // we need to track not only multistreams with upstreams but all of them
// because upstreams can be added in runtime with hot config reload // because upstreams can be added in runtime with hot config reload
multistreamHolder.all() val sources = multistreamHolder.all()
.filter { Common.ChainRef.forNumber(it.getChain().id) != null } .filter { Common.ChainRef.forNumber(it.getChain().id) != null }
.map { ms -> .map { ms ->
Flux.concat( Flux.concat(
@@ -40,8 +39,9 @@ class SubscribeChainStatus(
multistreamEvents(ms), multistreamEvents(ms),
), ),
) )
}, }
).doOnError { return Flux.merge(Flux.fromIterable(sources), sources.size)
.doOnError {
log.error("Error during sending chain statuses", it) log.error("Error during sending chain statuses", it)
} }
} }