diff --git a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt index 230c1a558..044a1f374 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/activities/MainActivity.kt @@ -34,7 +34,7 @@ import org.jsoup.Jsoup class MainActivity : BaseMainActivity() { override val fragmentChannel = BroadcastChannel(10) - override val headerBadgeChannel = Channel(Channel.RENDEZVOUS) + override val headerBadgeChannel = Channel(Channel.CONFLATED) var lastPosition = -1 override fun onNestedCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt index 72d8803ca..575e5a4dc 100644 --- a/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt +++ b/app/src/main/kotlin/com/pitchedapps/frost/views/FrostContentView.kt @@ -43,6 +43,7 @@ import com.pitchedapps.frost.utils.Prefs import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.ExperimentalCoroutinesApi import kotlinx.coroutines.channels.BroadcastChannel +import kotlinx.coroutines.channels.ConflatedBroadcastChannel import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.launch @@ -82,9 +83,13 @@ abstract class FrostContentView @JvmOverloads constructor( override val core: FrostContentCore get() = coreView - override val refreshChannel: BroadcastChannel = BroadcastChannel(100) - override val progressChannel: BroadcastChannel = BroadcastChannel(100) - override val titleChannel: BroadcastChannel = BroadcastChannel(100) + /** + * While this can be conflated, there exist situations where we wish to watch refresh cycles. + * Here, we'd need to make sure we don't skip events + */ + override val refreshChannel: BroadcastChannel = BroadcastChannel(10) + override val progressChannel: BroadcastChannel = ConflatedBroadcastChannel() + override val titleChannel: BroadcastChannel = ConflatedBroadcastChannel() override lateinit var scope: CoroutineScope diff --git a/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt b/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt index e75207949..fb3026480 100644 --- a/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt +++ b/app/src/test/kotlin/com/pitchedapps/frost/utils/CoroutineTest.kt @@ -150,12 +150,12 @@ class CoroutineTest { /** * Not a true throttle, but for things like fetching header badges, we want to avoid simultaneous fetches. - * As a result, I want to test that the usage of offer along with a rendezvous channel will work as I expect. + * As a result, I want to test that the usage of offer along with a conflated channel will work as I expect. * Events should be consumed when there is no pending consumer on previous elements. */ @Test fun throttledChannel() { - val channel = Channel(Channel.RENDEZVOUS) + val channel = Channel(Channel.CONFLATED) runBlocking { val deferred = async { listen(channel) {