Open jonschmidt opened 3 years ago
I don't think the sampling of Flow.sample() should start until after the first element is received. There is even a comment to back that up: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/flow/operators/Delay.kt#L298
I am currently running into this problem as I am sampling user drag input and sending network requests to do geo-location. I am using sample to not send too many requests, but it seems that it is delaying the first request as well.
This behaviour is yet to be designed, but now it's just done consistently with the similar operator from RxJava
RxJava
I don't think the sampling of Flow.sample() should start until after the first element is received. There is even a comment to back that up: https://github.com/Kotlin/kotlinx.coroutines/blob/master/kotlinx-coroutines-core/common/src/flow/operators/Delay.kt#L298
I am currently running into this problem as I am sampling user drag input and sending network requests to do geo-location. I am using sample to not send too many requests, but it seems that it is delaying the first request as well.