A provider lookup paced out of the hour's budget starts no cooldown (build 67)
18 November 2026, After Dark's first read after the server move: it spent the hour's 190 requests, and the approvals still waiting were counted as found-nothing and put on the 6-hour cooldown. A lookup that couldn't be made (paced out, the server not answering) now throws past IdRepairs and records nothing, so the approval is simply tried again at the next read. Tests for both. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -99,3 +99,34 @@ class RemakeGuardTest {
|
||||
} finally { EmbyServer.origin = ""; IdRepairs.resetForTest() }
|
||||
}
|
||||
}
|
||||
|
||||
/** 18 November 2026: After Dark's first read after the move ran out of the hour's budget mid-way. */
|
||||
class PacedLookupTest {
|
||||
@org.junit.Before fun clean() { IdRepairs.resetForTest(); EmbyServer.origin = "https://emby.example.com" }
|
||||
@org.junit.After fun after() { IdRepairs.resetForTest(); EmbyServer.origin = "" }
|
||||
|
||||
@Test fun aLookupThatCouldntBeMadeStartsNoCooldown() {
|
||||
assertThrows(PacedOut::class.java) { IdRepairs.lookup("Movie", "imdb.tt5", 0L) { throw PacedOut() } }
|
||||
assertFalse(IdRepairs.coolingDown("Movie", "imdb.tt5", 1L))
|
||||
assertEquals("ok", IdRepairs.lookup("Movie", "imdb.tt5", 2L) { "ok" })
|
||||
}
|
||||
|
||||
@Test fun anApprovalPacedOutIsTriedAgainAtTheNextRead() {
|
||||
var paced = true
|
||||
val transport = EmbyTransport { r ->
|
||||
when {
|
||||
paced && "AnyProviderIdEquals" in r.path -> throw PacedOut()
|
||||
"AnyProviderIdEquals=imdb.tt0100814" in r.path -> EmbyReply(200, JSONObject().put("Items", org.json.JSONArray().put(JSONObject().put("Id", "new1").put("Name", "Tremors").put("Type", "Movie"))).toString())
|
||||
"Ids=new1" in r.path -> EmbyReply(200, JSONObject().put("Items", org.json.JSONArray().put(JSONObject().put("Id", "new1").put("Name", "Tremors").put("Type", "Movie")
|
||||
.put("MediaSources", org.json.JSONArray().put(JSONObject().put("Id", "s1").put("Container", "mkv").put("RunTimeTicks", 90 * 60_000L * 10_000))))).toString())
|
||||
else -> EmbyReply(200, JSONObject().put("Items", org.json.JSONArray()).toString())
|
||||
}
|
||||
}
|
||||
val s = EmbySampleSession(transport, "fixture-token-private", "fixture-user", EmbySample(emptyList(), 0))
|
||||
val channel = ChannelProgramming(305, "After Dark", emptyList(), filmRestMs = 1L)
|
||||
val choices = ChannelChoices(listOf(Suggestion("moved-1", "Tremors", 1990, "Movie", "", "", ref = "imdb.tt0100814")))
|
||||
assertTrue(s.readChannelPool(channel, null, choices).series.isEmpty())
|
||||
paced = false
|
||||
assertEquals(listOf("new1"), s.readChannelPool(channel, null, choices).series.map { it.id })
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user