musikr.pipeline: disable extraction shuffling

No longer needed now that jpeg writes are extremely quick. Will
re-introduce in the case that I introduce webp parsing again.
This commit is contained in:
Alexander Capehart 2024-12-20 22:06:41 -05:00
parent a598f39dea
commit 9f68f59504
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 0 additions and 13 deletions

View file

@ -90,7 +90,6 @@ private class ExtractStepImpl(
val fds = val fds =
uncachedSongs uncachedSongs
.shuffle()
.mapNotNull { .mapNotNull {
wrap(it) { file -> wrap(it) { file ->
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {

View file

@ -82,15 +82,3 @@ internal fun <T> Flow<T>.distribute(n: Int): DistributedFlow<T> {
val hotFlows = posChannels.map { it.receiveAsFlow() }.toTypedArray() val hotFlows = posChannels.map { it.receiveAsFlow() }.toTypedArray()
return DistributedFlow(managerFlow, hotFlows) return DistributedFlow(managerFlow, hotFlows)
} }
internal fun <T> Flow<T>.shuffle() = flow {
// As far as I'm aware, the only way to get a truly normal distribution
// on a flow is by evaluating it. I tried a bunch of different strategies
// on lazily shuffling a flow and it simply doesn't produce a good enough
// distribution since you need to emit late stuff early and early stuff
// late. It's best to just eval and re-emit.
val output = mutableListOf<T>()
toList(output)
output.shuffle()
emitAll(output.asFlow())
}