fixes in aggregation of flows

This commit is contained in:
InsanusMokrassar 2020-10-27 15:51:48 +06:00
parent b053c29ea3
commit 37a23c7e79
1 changed files with 1 additions and 2 deletions

View File

@ -13,13 +13,12 @@ fun <T> aggregateFlows(
internalBufferSize: Int = 64
): Flow<T> {
val sharedFlow = MutableSharedFlow<T>(extraBufferCapacity = internalBufferSize)
val bc = BroadcastChannel<T>(internalBufferSize)
flows.forEach {
it.onEach {
safely { sharedFlow.emit(it) }
}.launchIn(withScope)
}
return bc.asFlow()
return sharedFlow
}
fun <T> Flow<Iterable<T>>.flatMap(): Flow<T> = flow {