Fix ConcurrentModificationException caused by coroutines

This commit is contained in:
Kirill Kamakin
2021-11-20 14:07:09 +03:00
parent 5866584d14
commit 1985764340

View File

@@ -13,6 +13,7 @@ class RecipePagingSourceFactory @Inject constructor(
) : () -> PagingSource<Int, RecipeSummaryEntity> {
private val sources: MutableList<PagingSource<Int, RecipeSummaryEntity>> = mutableListOf()
@Synchronized
override fun invoke(): PagingSource<Int, RecipeSummaryEntity> {
Timber.v("invoke() called")
val newSource = recipeStorage.queryRecipes()
@@ -20,6 +21,7 @@ class RecipePagingSourceFactory @Inject constructor(
return newSource
}
@Synchronized
fun invalidate() {
Timber.v("invalidate() called")
for (source in sources) {