Relax freshness limits and tolerate transient RCON failures
This commit is contained in:
@@ -177,6 +177,7 @@ async function refreshServerStatus(server: string, probeStatus?: () => ReturnTyp
|
||||
const unavailable = updates.container_state === 'unknown';
|
||||
if (!container.ok && !unavailable) {
|
||||
updates.last_error = null;
|
||||
updates.rcon_failures = 0;
|
||||
updates.last_reply_snippet = null;
|
||||
} else if (unavailable || !telemetryEvidence(srv.name)) {
|
||||
flush();
|
||||
@@ -192,7 +193,8 @@ async function refreshServerStatus(server: string, probeStatus?: () => ReturnTyp
|
||||
});
|
||||
if (!probe) return null;
|
||||
const result = probe.result;
|
||||
if (unchanged() && (getServer(srv.name)?.last_checked_at ?? '') <= probe.observedAt) {
|
||||
const previous = getServer(srv.name);
|
||||
if (unchanged() && previous && (previous.last_checked_at ?? '') <= probe.observedAt) {
|
||||
gameObservation = probe;
|
||||
const now = probe.observedAt;
|
||||
updates.last_checked_at = now;
|
||||
@@ -205,13 +207,23 @@ async function refreshServerStatus(server: string, probeStatus?: () => ReturnTyp
|
||||
updates.last_roster = JSON.stringify(result.status.roster);
|
||||
updates.last_seen_at = now;
|
||||
updates.last_error = null;
|
||||
} else updates.last_error = encodeError(result.reason, result.detail);
|
||||
updates.rcon_failures = 0;
|
||||
} else {
|
||||
// Only distinct accepted checks in the current lifecycle count.
|
||||
// Skipped/superseded checks return above without changing the streak.
|
||||
const consecutive = previous.last_error && (!epoch || (previous.last_checked_at ?? '') > epoch);
|
||||
const failures = consecutive ? previous.rcon_failures || 1 : 0;
|
||||
updates.rcon_failures = consecutive && previous.last_checked_at === now
|
||||
? failures : Math.min(2, failures + 1);
|
||||
updates.last_error = encodeError(result.reason, result.detail);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!settling && unchanged()) publishObservation(inspected, gameObservation);
|
||||
}
|
||||
} else {
|
||||
updates.last_error = null;
|
||||
updates.rcon_failures = 0;
|
||||
updates.last_reply_snippet = null;
|
||||
}
|
||||
flush();
|
||||
|
||||
Reference in New Issue
Block a user