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

Offer for Channel can cause dropped elements #52

Open
eygraber opened this issue Jul 23, 2019 · 2 comments
Open

Offer for Channel can cause dropped elements #52

eygraber opened this issue Jul 23, 2019 · 2 comments

Comments

@eygraber
Copy link

I've been using TextView.textChanges and there's an issue with using safeOffer and capacity = RENDEZVOUS. If the consumer suspends before receiving again (e.g. calls delay for whatever reason), and elements are offered during this time (i.e. more text is typed), offer will fail, and those elements will never get sent/received.

It's not immediately obvious that capacity = RENDEZVOUS is the default, and that safeOffer causes the problem. The solution would be to call send in a launch (either from the GlobalScope or pass a CoroutineScope in).

@satoshun
Copy link
Owner

Sorry too late response.

I plan that replace ReceiveChannel API with Flow. Flow API(+ buffer or broadcastIn) to the rescue this issue.

@afollestad
Copy link

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

No branches or pull requests

3 participants