musikr: tweak flow splitter
Might make things more efficient?
This commit is contained in:
@@ -55,11 +55,11 @@ internal fun <T, R> Flow<T>.distributedMap(
|
|||||||
for (channel in posChannels) {
|
for (channel in posChannels) {
|
||||||
channel.close()
|
channel.close()
|
||||||
}
|
}
|
||||||
}
|
}.buffer()
|
||||||
return (posChannels.map { it.receiveAsFlow() } + managerFlow)
|
return (posChannels.map { it.receiveAsFlow() } + managerFlow)
|
||||||
.asFlow()
|
.asFlow()
|
||||||
.map { it.tryMap(block).flowOn(on).buffer(buffer) }
|
.map { it.tryMap(block).flowOn(on) }
|
||||||
.flattenMerge()
|
.flattenMerge(concurrency = n + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal fun <T, R> Flow<T>.tryMap(transform: suspend (T) -> R): Flow<R> = flow {
|
internal fun <T, R> Flow<T>.tryMap(transform: suspend (T) -> R): Flow<R> = flow {
|
||||||
|
|||||||
Reference in New Issue
Block a user