Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sample should not start sampling until after the first element is received #2655

Open
jonschmidt opened this issue Apr 16, 2021 · 1 comment

Comments

@jonschmidt
Copy link

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.

@qwwdfsad
Copy link
Collaborator

This behaviour is yet to be designed, but now it's just done consistently with the similar operator from RxJava

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants