Kotlin Coroutine with Room Database scenarios Silently on Fetching Large Data Set
Quick question that's been bugging me - After trying multiple solutions online, I still can't figure this out. I'm refactoring my project and I'm working with an scenario where my Kotlin coroutine is not returning any data when fetching a large dataset from a Room database. I've implemented a simple query to get all items from a table, but it seems to execute silently without any errors or results, particularly when the dataset exceeds 10,000 entries. My code looks like this: ```kotlin @Dao interface ItemDao { @Query("SELECT * FROM items") suspend fun getAllItems(): List<Item> } ``` And I'm launching the coroutine in my ViewModel like this: ```kotlin class MyViewModel(private val repository: ItemRepository) : ViewModel() { private val _items = MutableStateFlow<List<Item>>(emptyList()) val items: StateFlow<List<Item>> = _items fun loadItems() { viewModelScope.launch { val loadedItems = repository.getAllItems() _items.value = loadedItems } } } ``` The `loadItems()` function is called in the fragment when the view is created. However, when I have more than 10,000 entries in the database, the `loadedItems` list remains empty, and I don't see any exceptions or errors in the logcat. I've tried checking the database directly using Room's Database Inspector, and the entries are there. Also, I confirmed that the Room database is set up correctly and is being populated without issues. For testing, I reduced the dataset below 10,000 entries, and everything works as expected. My Room version is 2.4.2, and Iām using Kotlin Coroutines version 1.5.2. Is there a limitation or known scenario with fetching large datasets using coroutines in Room? I would appreciate any insights or suggestions on how to troubleshoot this further. I recently upgraded to Kotlin 3.10. I've been using Kotlin for about a year now. Has anyone dealt with something similar? Has anyone dealt with something similar?