From c3b8eb508724365cc6484530f30334408b394b9b Mon Sep 17 00:00:00 2001 From: Vitor Pamplona Date: Fri, 4 Aug 2023 21:02:45 -0400 Subject: [PATCH] Puts an invalidate data on an IO thread --- .../vitorpamplona/amethyst/ui/screen/FeedViewModel.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt index 7ae02473c..c35d629c6 100644 --- a/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt +++ b/app/src/main/java/com/vitorpamplona/amethyst/ui/screen/FeedViewModel.kt @@ -292,10 +292,12 @@ abstract class FeedViewModel(val localFilter: FeedFilter) : ViewModel(), I private val bundlerInsert = BundledInsert>(250, Dispatchers.IO) override fun invalidateData(ignoreIfDoing: Boolean) { - bundler.invalidate(ignoreIfDoing) { - // adds the time to perform the refresh into this delay - // holding off new updates in case of heavy refresh routines. - refreshSuspended() + viewModelScope.launch(Dispatchers.IO) { + bundler.invalidate(ignoreIfDoing) { + // adds the time to perform the refresh into this delay + // holding off new updates in case of heavy refresh routines. + refreshSuspended() + } } }