A stumble should not colour the desk red for the rest of the service
Build 121. Three things a single 16 s stall did that it should not have. captionOnlyFinals is a running total for the whole service, and the verdict tested it for more than zero — so one stale sentence pinned the light red until the next restart. MEASURED: a campus Mac stalled once at 14:25, recovered immediately to a 421 ms lag with an empty queue, and still showed red half an hour later, with the operator quite reasonably reporting it as behind. The totals still travel for the record; the verdict now asks when it last happened, inside a two-minute window. A light that cannot go back to green teaches the desk to ignore it. That sentence also had its translations skipped. Dropping them is how the app catches up — the listener has moved on and the time is better spent on what is behind it. But that reasoning needs a backlog, and the queue was EMPTY: the room lost a line of the sermon to a catch-up that had nothing to catch up on. It now skips only when something is actually waiting, and says plainly when it chooses to translate a late sentence anyway. The stall itself was not the app. Two Screen Sharing sessions were taking as much of the machine as the app was, with WindowServer on top — watching a campus Mac during a service measurably degrades it. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5
parent
39dea80433
commit
a06cf35cbb
+29
-4
@@ -190,7 +190,9 @@ const state = {
|
||||
|
||||
/* health counters, reported to the operator page */
|
||||
degradedFinals: 0, // finals that shipped with fewer languages (stale)
|
||||
captionOnlyFinals: 0 // finals that shipped with no translations at all
|
||||
captionOnlyFinals: 0, // finals that shipped with no translations at all
|
||||
captionOnlyAt: 0, // when the last one happened
|
||||
degradedAt: 0
|
||||
};
|
||||
|
||||
// ────────────────────────────────────────────────────────── logging
|
||||
@@ -1891,15 +1893,33 @@ async function pump() {
|
||||
const sentences = collapseLoops(splitSentences(text));
|
||||
|
||||
let targets = orderedTargets();
|
||||
if (ageSec > 12) {
|
||||
/*
|
||||
* SKIPPING A TRANSLATION ONLY BUYS SOMETHING IF THERE IS A QUEUE TO DRAIN.
|
||||
*
|
||||
* Dropping the translations of stale audio is how the app catches up: the
|
||||
* listener has moved on, so the work is wasted and the time is better spent on
|
||||
* the sentences behind it. That reasoning needs a backlog. With nothing waiting
|
||||
* behind it, skipping costs the room a sentence and saves nothing at all.
|
||||
*
|
||||
* MEASURED: a campus Mac took one 16 s stall — two Screen Sharing sessions
|
||||
* competing for the machine — and skipped that sentence's translations with an
|
||||
* EMPTY queue. The room lost a line of the sermon to a catch-up that had
|
||||
* nothing to catch up on.
|
||||
*/
|
||||
if (ageSec > 12 && queue.length > 0) {
|
||||
targets = [];
|
||||
state.captionOnlyFinals++;
|
||||
log('audio ' + ageSec.toFixed(0) + 's stale — caption only, translations skipped', 'err');
|
||||
state.captionOnlyAt = Date.now();
|
||||
log('audio ' + ageSec.toFixed(0) + 's stale with ' + queue.length + ' waiting — ' +
|
||||
'caption only, translations skipped', 'err');
|
||||
} else if (ageSec > 12) {
|
||||
/* Late, but nothing is behind it: say so, and translate it anyway. */
|
||||
log('audio ' + ageSec.toFixed(0) + 's late, but nothing is queued — translating it anyway', 'warn');
|
||||
} else if (ageSec > 6) {
|
||||
const listening = new Set((state.byLanguage || []).map((r) => r.lang));
|
||||
const before = targets.length;
|
||||
targets = targets.filter((t) => listening.has(t));
|
||||
if (targets.length < before) state.degradedFinals++;
|
||||
if (targets.length < before) { state.degradedFinals++; state.degradedAt = Date.now(); }
|
||||
}
|
||||
|
||||
/* The segment's own loudness, measured once and shared by every sentence
|
||||
@@ -2758,6 +2778,7 @@ function goLive(on) {
|
||||
state.live = on;
|
||||
if (on) {
|
||||
state.degradedFinals = 0; state.captionOnlyFinals = 0; state.fragmentFinals = 0;
|
||||
state.captionOnlyAt = 0; state.degradedAt = 0;
|
||||
/* The watchdog measures from the start of the service, not from the last
|
||||
sentence of the previous one. */
|
||||
state.lastFinalAt = Date.now();
|
||||
@@ -2832,6 +2853,10 @@ function reportStatus() {
|
||||
queue: queue.length,
|
||||
degradedFinals: state.degradedFinals,
|
||||
captionOnlyFinals: state.captionOnlyFinals,
|
||||
/* WHEN, not just how many — the verdict needs to know whether this is
|
||||
happening now or happened once an hour ago. */
|
||||
captionOnlyAt: state.captionOnlyAt || 0,
|
||||
degradedAt: state.degradedAt || 0,
|
||||
fragmentFinals: state.fragmentFinals || 0,
|
||||
cloud: state.cloudStats || null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user