Add reset-latency StartOS action
Calls POST /api/admin/reset-latency to zero the block-update latency counters. Available while the service is running, no warning needed.
This commit is contained in:
@@ -249,6 +249,46 @@ export const action: T.ExpectedExports.action = {
|
||||
};
|
||||
},
|
||||
|
||||
// ── Reset block latency ─────────────────────────────────────────────────────
|
||||
"reset-latency": async (effects) => {
|
||||
try {
|
||||
const res = await effects.fetch(`${API_BASE}/api/admin/reset-latency`, {
|
||||
method: "POST",
|
||||
});
|
||||
if (!res.ok) {
|
||||
const body = await res.text();
|
||||
return {
|
||||
result: {
|
||||
version: "0",
|
||||
message: "Failed to reset latency stats",
|
||||
value: `API returned ${res.status}: ${body}`,
|
||||
copyable: false,
|
||||
qr: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
} catch (e) {
|
||||
return {
|
||||
result: {
|
||||
version: "0",
|
||||
message: "Failed — API unreachable",
|
||||
value: `Could not reach kamado-api: ${(e as Error).message}`,
|
||||
copyable: false,
|
||||
qr: false,
|
||||
},
|
||||
};
|
||||
}
|
||||
return {
|
||||
result: {
|
||||
version: "0",
|
||||
message: "Block latency stats reset to zero",
|
||||
value: "All latency counters (count, avg, last, wasted work) have been cleared.\nNew measurements will accumulate from the next block.",
|
||||
copyable: false,
|
||||
qr: false,
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
// ── Regenerate TLS certificate ──────────────────────────────────────────────
|
||||
"regen-tls-cert": async (effects) => {
|
||||
const VOLUME = "main";
|
||||
|
||||
Reference in New Issue
Block a user