alexstyl / contactstore

A modern, strongly-typed contacts API for Android.
https://alexstyl.github.io/contactstore
Apache License 2.0
440 stars 15 forks source link

ANR -> trySendBlocking is incorrectly called in callBackFlow #19

Closed rbenza closed 2 years ago

rbenza commented 2 years ago

I think trySendBlocking is incorrectly called here: https://github.com/alexstyl/contactstore/blob/1addc3efad4b9abf6d9e8210a9aa98e2f4d9c255/library/src/main/java/com/alexstyl/contactstore/UriFlow.kt

I already saw couple of ANR's in production, probably when a user removes a group of contacts at once. Then onChanged gets() called frequently in a row. Tested it with a log statement.

To resolve this we should check if the Channel is open, and if so call trySend(). PR to fix this: https://github.com/alexstyl/contactstore/pull/20

alexstyl commented 2 years ago

Many thanks for the contribution @rbenza.

I'm planning of shipping a new version earlier in the day with this change included.

Closing this as resolved.

rbenza commented 2 years ago

Great, you're welcome