-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Flow.sample() - incorrect documentation example or bug #2243
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
Comments
Thanks a lot! Timings here are indeed a bit unrealistic, so it only works under virtual time, not in reality. Will fix. |
elizarov
added a commit
that referenced
this issue
Sep 22, 2020
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit. * Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too. Fixes #2243
elizarov
added a commit
that referenced
this issue
Sep 22, 2020
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit. * Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too. Fixes #2243
Got it. Yes, definitely noticed that unit tests would pass, but behaves differently otherwise. Thanks @elizarov! |
recheej
pushed a commit
to recheej/kotlinx.coroutines
that referenced
this issue
Dec 28, 2020
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit. * Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too. Fixes Kotlin#2243
recheej
pushed a commit
to recheej/kotlinx.coroutines
that referenced
this issue
Dec 28, 2020
* All Flow.debounce/sample KDoc example code snippets are automatically tested with Knit. * Flow.sample timings are made larger, so that they produce an expected output when run under the real time, too. Fixes Kotlin#2243
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The example provided in the docs for
Flow.sample(...)
does not seem to behave as the documentation states:According to documentation, expected output:
1 3 5 7 9
Actual output :
2 4 6 8
(sometimes even2 4 6 8 9
)However,
debounce
's example works as documented when tested side-by-side here: https://pl.kotl.in/NS_M7Sx01This could even be a bug with the playground, but it's weird that
debounce
works as expected in the same environment 🤔The text was updated successfully, but these errors were encountered: