Own server: the catalogue read in five nights, not 23; the Chair's learning label follows the press (1.0 RC3-7, build 49)
Paul, 15 November 2026. With 'This is my server' on, the overnight catalogue read takes 25 pages an hour, two minutes apart (25,000 titles a night), from 5. The learning switch showed its new state only after the report was worked out again, so a second press looked needed and turned learning back off; the label now changes at once. 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 = 48
|
||||
val ORBIT_BUILD = 49
|
||||
android {
|
||||
namespace = "tv.orbit.classic"
|
||||
compileSdk = 36
|
||||
|
||||
@@ -111,11 +111,16 @@ internal class ChannelScheduler(private val store: ScheduleStore,
|
||||
* take four months). Between 01:00 and 06:00, five pages of 200 an hour, six minutes apart: 5,000 titles a night, and
|
||||
* nothing while people are likely to be watching. The daytime refresh carries on as before; once the read is whole this
|
||||
* does nothing.
|
||||
*
|
||||
* On the household's own server ([ownServer], 15 November 2026: the capacity test showed no strain up to ~126 requests a
|
||||
* minute) it reads five times as much, 25 pages an hour two minutes apart: 25,000 titles a night, a 115,000-title library
|
||||
* in five nights rather than 23.
|
||||
*/
|
||||
fun overnightCatalogue(session: EmbySampleSession, userId: String, catalogue: CatalogueStore, nowMs: Long = clock(), pause: () -> Unit = { Thread.sleep(OVERNIGHT_PAGE_GAP_MS) }) {
|
||||
fun overnightCatalogue(session: EmbySampleSession, userId: String, catalogue: CatalogueStore, nowMs: Long = clock(), ownServer: Boolean = false,
|
||||
pause: () -> Unit = { Thread.sleep(if (ownServer) OWN_SERVER_PAGE_GAP_MS else OVERNIGHT_PAGE_GAP_MS) }) {
|
||||
val hour = java.time.Instant.ofEpochMilli(nowMs).atZone(java.time.ZoneId.systemDefault()).hour
|
||||
if (hour !in OVERNIGHT_HOURS || catalogue.complete()) return
|
||||
val run = session.importCatalogue(catalogue, OVERNIGHT_PAGES_PER_HOUR, pause = pause)
|
||||
val run = session.importCatalogue(catalogue, if (ownServer) OWN_SERVER_PAGES_PER_HOUR else OVERNIGHT_PAGES_PER_HOUR, pause = pause)
|
||||
Log.i("OrbitSchedule", "overnight catalogue pages=${run.pages} read=${run.records} finished=${run.finished}")
|
||||
}
|
||||
|
||||
@@ -434,3 +439,6 @@ internal object SeriesInspection {
|
||||
internal val OVERNIGHT_HOURS = 1..5
|
||||
internal const val OVERNIGHT_PAGES_PER_HOUR = 5
|
||||
internal const val OVERNIGHT_PAGE_GAP_MS = 6 * 60_000L
|
||||
/** On the household's own server: see [ChannelScheduler.overnightCatalogue]. */
|
||||
internal const val OWN_SERVER_PAGES_PER_HOUR = 25
|
||||
internal const val OWN_SERVER_PAGE_GAP_MS = 2 * 60_000L
|
||||
|
||||
@@ -425,10 +425,14 @@ internal fun DirectorChair(load: (DirectorMode) -> DeskReport?, first: FocusRequ
|
||||
Spacer(Modifier.width(8.dp))
|
||||
Text("Auto-approval: OFF", color = ChairMint, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
|
||||
Spacer(Modifier.width(8.dp))
|
||||
val learningOn = report?.learningOn == true
|
||||
// The label follows the press at once (15 November 2026: it waited for the report to be worked out again, so a
|
||||
// second press looked needed and turned learning straight back off).
|
||||
var pressed by remember { mutableStateOf<Boolean?>(null) }
|
||||
LaunchedEffect(report?.learningOn) { if (report?.learningOn == pressed) pressed = null }
|
||||
val learningOn = pressed ?: (report?.learningOn == true)
|
||||
var learnFocused by remember { mutableStateOf(false) }
|
||||
Text("Learning: " + if (learningOn) "ON" else "OFF", Modifier.onFocusChanged { learnFocused = it.isFocused }
|
||||
.clickable { scope.launch { setLearning(!learningOn); said = if (learningOn) "Learning off: suggestions come from the channel briefs alone." else "Learning on: what it's learned from your decisions now shapes the suggestions."; version++ } }
|
||||
.clickable { pressed = !learningOn; scope.launch { setLearning(!learningOn); said = if (learningOn) "Learning off: suggestions come from the channel briefs alone." else "Learning on: what it's learned from your decisions now shapes the suggestions."; version++ } }
|
||||
.background(if (learningOn) ChairMint else ChairPanel, RoundedCornerShape(12.dp)).border(if (learnFocused) 2.dp else 0.dp, Ink, RoundedCornerShape(12.dp))
|
||||
.padding(horizontal = 10.dp, vertical = 3.dp), color = if (learningOn) ChairOnGold else Ink, fontSize = 11.sp, fontWeight = FontWeight.SemiBold)
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ internal fun EmbyConnectionScreen(modifier: Modifier = Modifier, visible: Boolea
|
||||
directorReports(scheduleStore, catalogue, active.accountId) } } }
|
||||
catch (cancelled: CancellationException) { throw cancelled }
|
||||
catch (failure: Exception) { android.util.Log.w("OrbitSchedule", "evidence failed=${failure.javaClass.simpleName}") }
|
||||
if (!quiet) try { withContext(Dispatchers.IO) { BackgroundPacing.run { scheduler.overnightCatalogue(active, active.accountId, catalogue) } } }
|
||||
if (!quiet) try { withContext(Dispatchers.IO) { BackgroundPacing.run { scheduler.overnightCatalogue(active, active.accountId, catalogue, ownServer = workspace.ownServer) } } }
|
||||
catch (cancelled: CancellationException) { throw cancelled }
|
||||
catch (failure: Exception) { android.util.Log.w("OrbitSchedule", "overnight catalogue failed=${failure.javaClass.simpleName}") }
|
||||
try { withContext(Dispatchers.IO) { BackgroundPacing.run { scheduler.refreshArrivals(active, active.accountId, catalogue) } } }
|
||||
|
||||
@@ -76,6 +76,9 @@ class SafetyLimitsTest {
|
||||
@Test fun theOvernightReadOnlyRunsInTheSmallHours() {
|
||||
assertEquals(1..5, OVERNIGHT_HOURS)
|
||||
assertEquals(5_000, OVERNIGHT_HOURS.count() * OVERNIGHT_PAGES_PER_HOUR * CATALOGUE_PAGE_SIZE)
|
||||
// The household's own server: 25,000 a night, still inside an hour each night.
|
||||
assertEquals(25_000, OVERNIGHT_HOURS.count() * OWN_SERVER_PAGES_PER_HOUR * CATALOGUE_PAGE_SIZE)
|
||||
assertTrue(OWN_SERVER_PAGES_PER_HOUR * OWN_SERVER_PAGE_GAP_MS <= 60 * 60_000L)
|
||||
}
|
||||
|
||||
@Test fun ownServerSkipsTheQuietWeek() {
|
||||
|
||||
Reference in New Issue
Block a user