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

flowOf("a", "b").onCompletion { emit("Done") }.first() returns "Done" #1654

Closed
mtopolnik opened this issue Nov 11, 2019 · 0 comments
Closed

Comments

@mtopolnik
Copy link
Contributor

If I run this program:

suspend fun main() {
    flowOf("a", "b")
            .onCompletion { emit("Done") }
            .first()
            .also { println(it) }
}

I expect to see the output a, but the actual output is Done.

qwwdfsad added a commit that referenced this issue Nov 12, 2019
    * We cannot allow emitting elements when downstream exception occurred, otherwise it may lead to a weird side-effects when "collect" block (or any other terminal operator) has thrown an exception, but keeps receiving new values
    * Another solution may be to silently ignore emitted values, but it may lead to a postponed cancellation and surprising behaviour for users

Fixes #1654
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