musikr: tweak flow splitter

Might make things more efficient?
This commit is contained in:
Alexander Capehart
2025-07-05 14:12:07 -06:00
parent 0702c92774
commit 9886ec913c
@@ -55,11 +55,11 @@ internal fun <T, R> Flow<T>.distributedMap(
for (channel in posChannels) {
channel.close()
}
}
}.buffer()
return (posChannels.map { it.receiveAsFlow() } + managerFlow)
.asFlow()
.map { it.tryMap(block).flowOn(on).buffer(buffer) }
.flattenMerge()
.map { it.tryMap(block).flowOn(on) }
.flattenMerge(concurrency = n + 1)
}
internal fun <T, R> Flow<T>.tryMap(transform: suspend (T) -> R): Flow<R> = flow {