Queue wait is visible: 'Queued… · Ns' + created_at on job payloads
This commit is contained in:
parent
1dde1019e9
commit
3e1ec8eff8
4 changed files with 30 additions and 2 deletions
|
|
@ -709,7 +709,8 @@ fun DetailScreen(state: DesktopState) {
|
|||
"Summarizing… ${it.progress}%"
|
||||
it.status == "running" -> "Summarizing… waiting for model" +
|
||||
DesktopState.waitSuffix(it.startedAt, System.currentTimeMillis())
|
||||
else -> "Summary queued"
|
||||
else -> "Summary queued" +
|
||||
DesktopState.waitSuffix(it.createdAt, System.currentTimeMillis())
|
||||
}
|
||||
Text(label, style = MaterialTheme.typography.bodyMedium,
|
||||
color = MaterialTheme.colorScheme.primary)
|
||||
|
|
@ -885,7 +886,9 @@ fun DetailScreen(state: DesktopState) {
|
|||
}
|
||||
Text(buildString {
|
||||
append(when {
|
||||
sStatus == "queued" -> "Queued…"
|
||||
sStatus == "queued" -> "Queued…" +
|
||||
DesktopState.waitSuffix(sJob?.createdAt,
|
||||
System.currentTimeMillis())
|
||||
sProg != null && sProg > 0 -> "Summarizing… $sProg%"
|
||||
else -> "Summarizing… waiting for model" +
|
||||
DesktopState.waitSuffix(sJob?.startedAt,
|
||||
|
|
|
|||
|
|
@ -81,4 +81,23 @@ class JobProgressTest {
|
|||
assertEquals(" · 1:02", DesktopState.waitSuffix(
|
||||
t.minusSeconds(62).toString() + "Z", now))
|
||||
}
|
||||
|
||||
@Test fun `parseJobs surfaces created_at for queue wait`() {
|
||||
val raw = """[{"job_type":"summarize","status":"queued","attempt":0,
|
||||
"max_attempts":3,"created_at":"2026-09-16T15:50:12.556516"}]"""
|
||||
val jobs = com.shonar.recording.parseJobs(raw)
|
||||
assertEquals(1, jobs.size)
|
||||
assertEquals("2026-09-16T15:50:12.556516", jobs[0].createdAt)
|
||||
assertNull(jobs[0].startedAt)
|
||||
}
|
||||
|
||||
@Test fun `queued wait suffix counts from created_at`() {
|
||||
val t0 = System.currentTimeMillis() / 1000 * 1000
|
||||
val iso = java.time.LocalDateTime.ofInstant(
|
||||
java.time.Instant.ofEpochMilli(t0 - 124_000), java.time.ZoneOffset.UTC)
|
||||
.withNano(0).toString()
|
||||
// Same formatter the running-wait label uses: queued time is
|
||||
// visible time too, so it must count from created_at.
|
||||
assertEquals(" · 2:04", DesktopState.waitSuffix(iso, t0))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue