-
Notifications
You must be signed in to change notification settings - Fork 3k
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
[Bug]: Some combine
works on Main thread
#1420
Comments
Personally, umm... I'm not sure why If thread switching is implemented in the Repository and UseCase as you've modified, it seems that it could unnecessarily increase the amount of code to manage and make things more complicated. |
@yongsuk44 I added this |
@Jaehwa-Noh 😀 // Starting point of logic
.flowOn(Dispatchers)
.stateIn(...)
// Coroutine builder
viewModelScope.launch(Dispatcher) { ... }
viewModelScope.async(Dispatcher) { ... } By doing this, wouldn't it be possible to remove the Dispatcher dependencies in the UseCase and repository? Additionally, I also believe that performing complex computations on |
@yongsuk44 I don't think that Current data size isn't enormous, but there's no reason we carry out the risk. |
There is no need to worry about ANR as long as the thread is not blocked when working on Of course, if there are incredibly complex calculations or tasks that block the thread, it would be reasonable to switch to As I mentioned in a previous comment, I'm not sure if the increased amount of code that needs to be managed by adding Am I missing anything here? 🤔 |
@yongsuk44 You can check this documentation.
|
ANR occurs when the main thread is 'blocked' for a certain period of time. The suspension of coroutines and the blocking of threads are distinct concepts. Additionally, when implementing Room and Retrofit with the suspend modifier, the operations are handled on the IO. |
Is there an existing issue for this?
Is there a StackOverflow question about this issue?
What happened?
map
method incombine
flow works on Main thread.|
Relevant logcat output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: