Setting channels up no longer restarts the background round for each one (from release 0.108.54)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-11-06 12:47:22 +00:00
co-authored by Claude Opus 5.5
parent c9be5ab0a0
commit 409ccaf3df
@@ -48,6 +48,7 @@ import kotlinx.coroutines.CancellationException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.async
import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.Job
import kotlinx.coroutines.ensureActive
import kotlinx.coroutines.delay
@@ -373,6 +374,11 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
reminders = liveReminders(scheduleStore.loadReminders(active.accountId), System.currentTimeMillis()) } }
catch (cancelled: CancellationException) { throw cancelled }
catch (_: Exception) { /* The round below tries again. */ }
// Setting channels up adds each to extraChannels, which restarts this round from the first channel every time: with
// 30 channels that was hundreds of needless top-ups (seen on the upstairs box, 6 November 2026). Wait until setting up
// is over, and a moment more so a run of changes counts once.
androidx.compose.runtime.snapshotFlow { ChannelSetup.wanted.isEmpty() || ChannelSetup.finished }.first { it }
delay(3_000)
while (true) {
for (programming in SmartChannels) {
val loop = smartLoop(programming) ?: continue