https://kotlinlang.org logo
Title
d

dave08

01/01/2020, 3:20 PM
or do I need to do
flow { val result = client.download(url); emit(result) }
instead of using
flowOf
?
Seems so... it wasn't so obvious though...
d

Dominaezzz

01/01/2020, 4:11 PM
yes
d

dave08

01/01/2020, 4:12 PM
Isn't there a shorter way for such a common pattern?
d

Dominaezzz

01/01/2020, 4:12 PM
flatMapMerge
is a bit of a hack. I'd recommend not using it for concurrency and just do
async
yourself.
d

dave08

01/01/2020, 4:16 PM
Thanks! Good reference... is there any mention of why its a hack there and why async would be better?
d

Dominaezzz

01/01/2020, 4:17 PM
d

dave08

01/01/2020, 4:24 PM
Ok, now I got you, but in the meantime I don't see why https://github.com/Kotlin/kotlinx.coroutines/issues/1147#issuecomment-487531313
shouldn't be a partial solution... the name makes it pretty explicit...
d

Dominaezzz

01/01/2020, 4:28 PM
Yeah it's not too bad.
d

dave08

01/01/2020, 4:30 PM
Just wondering what bufferSize is for if there's concurrencyLevel param...?
It seems like the implementation has to be adapted a little since buffer() was added, but I can't seem to add that too?