From 409ccaf3df382c0bd45bcd3580925985ca10dd2f Mon Sep 17 00:00:00 2001 From: Pauljd Date: Fri, 6 Nov 2026 12:47:22 +0000 Subject: [PATCH] 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) --- .../src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt index e92289f..71bfda9 100644 --- a/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt +++ b/android/app/src/main/java/tv/orbit/classic/EmbyConnectionScreen.kt @@ -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