Setup counts toward the household's hour; comfort settings stay with each TV
- Channel setup (one request a second) now keeps to the household's share of SETUP_HOURLY (600) in any 60 minutes, slowing rather than refusing, so a channel always finishes (12 Nov: 502 requests in the living room's first hour). - Joining a room no longer copies reduce motion or subtitles: comfort settings stay with each TV, like its sound and picture switches. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -20,3 +20,19 @@ class HouseholdBudgetTest {
|
||||
assertEquals(BackgroundPacing.MIN_CEILING, BackgroundPacing.ceiling)
|
||||
}
|
||||
}
|
||||
|
||||
class SetupBudgetTest {
|
||||
@org.junit.After fun reset() = BackgroundPacing.resetForTest()
|
||||
@Test fun setupSlowsOnceTheHouseholdsHourIsUsedButNeverStops() {
|
||||
var now = 0L
|
||||
val waits = mutableListOf<Long>()
|
||||
BackgroundPacing.resetForTest()
|
||||
BackgroundPacing.clock = { now }
|
||||
BackgroundPacing.sleep = { ms -> waits += ms; now += ms }
|
||||
BackgroundPacing.tvs = 2
|
||||
BackgroundPacing.setup { repeat(301) { BackgroundPacing.beforeRequest() } }
|
||||
// 300 at a second apart, then the 301st waits 12 s (300 an hour for each of two TVs).
|
||||
assertEquals(1_000L, waits[waits.size - 2])
|
||||
assertEquals(12_000L, waits.last())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user