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:
@@ -166,6 +166,14 @@ actions:
|
|||||||
- stopped
|
- stopped
|
||||||
implementation:
|
implementation:
|
||||||
type: script
|
type: script
|
||||||
|
reset-latency:
|
||||||
|
name: "Reset Block Latency"
|
||||||
|
description: "Zeroes the block-update latency counters (avg, last, wasted work, block count). Use this after tuning ZMQ or ckpool to start fresh measurements."
|
||||||
|
warning: ~
|
||||||
|
allowed-statuses:
|
||||||
|
- running
|
||||||
|
implementation:
|
||||||
|
type: script
|
||||||
|
|
||||||
migrations:
|
migrations:
|
||||||
from:
|
from:
|
||||||
|
|||||||
@@ -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 ──────────────────────────────────────────────
|
// ── Regenerate TLS certificate ──────────────────────────────────────────────
|
||||||
"regen-tls-cert": async (effects) => {
|
"regen-tls-cert": async (effects) => {
|
||||||
const VOLUME = "main";
|
const VOLUME = "main";
|
||||||
|
|||||||
Reference in New Issue
Block a user