Every new channel finished in the same round (build 88)
Paul, 1 December 2026: build 87 finished one new channel's list per round, about an hour apart (Wonder TV 08:24, Heroes Live 09:35, Horror TV 10:37 downstairs). Every channel still on its first read is now finished in the same round, one after another, at setup's pace and within setup's hourly cap, then rebooked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -3,7 +3,7 @@ plugins {
|
||||
id("org.jetbrains.kotlin.plugin.compose")
|
||||
}
|
||||
/** The release's build number: versionCode is this x 10 plus the edition's channel. */
|
||||
val ORBIT_BUILD = 87
|
||||
val ORBIT_BUILD = 88
|
||||
android {
|
||||
namespace = "tv.orbit.classic"
|
||||
compileSdk = 36
|
||||
|
||||
@@ -13,8 +13,6 @@ internal const val POOL_REFRESH_MS = 7 * 24 * 60 * 60_000L
|
||||
*/
|
||||
internal const val POOL_JITTER_MS = 48 * 60 * 60_000L
|
||||
internal const val POOL_ROUTINE_GAP_MS = 30 * 60_000L
|
||||
/** A new channel's first read is finished in one go at most this often, so two never run at once ([ChannelScheduler.refreshStepwise]). */
|
||||
internal const val FIRST_READ_FINISH_GAP_MS = 10 * 60_000L
|
||||
internal fun poolJitterMs(number: Int): Long = (number.toLong() * 7_919L % 48L) * 60 * 60_000L
|
||||
/** Whether a cached list is old enough for its routine refresh. */
|
||||
internal fun poolRefreshDue(fetchedAtMs: Long, number: Int, nowMs: Long) = nowMs - fetchedAtMs >= POOL_REFRESH_MS + poolJitterMs(number)
|
||||
@@ -84,8 +82,6 @@ internal class ChannelScheduler(private val store: ScheduleStore,
|
||||
}
|
||||
/** When this TV last made a routine (weekly) list refresh; at most one per [POOL_ROUTINE_GAP_MS]. */
|
||||
@Volatile internal var lastRoutineRefreshMs = 0L
|
||||
/** When a first read was last finished in one go ([refreshStepwise]): one channel at a time. */
|
||||
@Volatile private var lastFirstReadFinishMs = 0L
|
||||
/** The order routine refreshes go in: see [RoutineQueue]. */
|
||||
internal val routineQueue = RoutineQueue()
|
||||
/** Disk only and quick, so the guide and player agree from the first frame after a restart. */
|
||||
@@ -436,10 +432,10 @@ internal class ChannelScheduler(private val store: ScheduleStore,
|
||||
val refresh = PoolRefresh(programming, choices, cached.series, earlierFilms(loop))
|
||||
val waiting = synchronized(refreshWaiting) { refreshWaiting.size + if (number in refreshWaiting) 0 else 1 }
|
||||
// A new channel's first read (its pool has no signature yet) is finished in one go, at setup's pace and within setup's
|
||||
// hourly cap, one channel at a time (Paul, 1 December 2026), so its week is booked from all its shows within minutes,
|
||||
// not a fair share a round over days. Later refreshes go a fair share at a time as before.
|
||||
val firstRead = cached.signature.isEmpty() && now - lastFirstReadFinishMs >= FIRST_READ_FINISH_GAP_MS
|
||||
if (firstRead) lastFirstReadFinishMs = now
|
||||
// hourly cap (Paul, 1 December 2026), so its week is booked from all its shows within minutes, not a fair share a round
|
||||
// over days. Every new channel waiting is finished in the same round, one after another: setup's pacing keeps their
|
||||
// requests a second apart however many there are. Later refreshes go a fair share at a time as before.
|
||||
val firstRead = cached.signature.isEmpty()
|
||||
val share = if (firstRead) Int.MAX_VALUE else refreshShare(BackgroundPacing.budget, BackgroundPacing.usedThisHour(), waiting)
|
||||
val step = try {
|
||||
if (firstRead) BackgroundPacing.asSetup {
|
||||
|
||||
Reference in New Issue
Block a user