Fix blank TPS: read tick timing from vanilla 'tick query' instead of spark
spark sends command output asynchronously, so its RCON responses are empty and the sampler recorded null TPS/MSPT. Use the synchronous vanilla 'tick query' as the primary source (treating paused/frozen idle servers as healthy), keep spark as fallback, and route spark ping / healthreport through the server console (mc-send-to-console) with the log watcher capturing ping lines. Lag endpoint now falls back to the freshest recorded ping sample. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
85414391b0
commit
6b7839360d
4 files changed
+77
-9
No files matched your search
@@ -40,7 +40,13 @@ export async function GET() {
|
||||
|
||||
const serverHealthy = (tps === null || tps >= 18) && (mspt === null || mspt <= 40);
|
||||
const players = online.map((name) => {
|
||||
const ping = livePings[name] ?? null;
|
||||
// spark's RCON reply is often empty (async output) — fall back to the
|
||||
// most recent logged sample if it's fresh enough.
|
||||
const hist = historyByPlayer[name] ?? [];
|
||||
const lastSample = hist.length > 0 ? hist[hist.length - 1] : null;
|
||||
const ping =
|
||||
livePings[name] ??
|
||||
(lastSample && Date.now() - lastSample.ts < 5 * 60 * 1000 ? lastSample.ping : null);
|
||||
return {
|
||||
name,
|
||||
ping,
|
||||
|
||||
Reference in new issue
Block a user