diff options
| author | tv <tv@krebsco.de> | 2026-11-06 23:55:48 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-06 23:55:48 +0100 |
| commit | df40d6d2aed2d1a3b5c02a0a2e14c7c234d035ef (patch) | |
| tree | ffe75b73040ca6f4c6a4bc5ef02dd5fc852c758a /src/api/dashboard/dashboard.html | |
| parent | e1ca004e979e038dd1f760f4e26b921e5de743fd (diff) | |
dashboard: remake switch delay
Diffstat (limited to 'src/api/dashboard/dashboard.html')
| -rw-r--r-- | src/api/dashboard/dashboard.html | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/api/dashboard/dashboard.html b/src/api/dashboard/dashboard.html index 9a395bb..771b49b 100644 --- a/src/api/dashboard/dashboard.html +++ b/src/api/dashboard/dashboard.html @@ -366,6 +366,10 @@ </div> <label>settle <input id="remake-settle" size="6" placeholder="default" title="How long votes are collected: seconds, or e.g. 500ms, 8m; empty: twice the dormancy threshold"></label> + <label>switch delay <input id="remake-switch-delay" size="6" placeholder="default" + title="How long nodes wait after the vote succeeded before switching, so the commit reaches every node first: seconds, or e.g. 500ms, 1m; empty: one keepalive interval"></label> + <label title="Accept a switch delay below a keepalive interval (?force=switchDelay): slow nodes may miss the commit before the others switch, and have to rejoin"><input + type="checkbox" id="remake-force-switch-delay"> even below a keepalive interval</label> <p class="note">Writes made meanwhile that no rule covers are quarantined on the node that made them.</p> <div class="actions"><button type="submit" class="toggle">propose</button> @@ -2947,13 +2951,17 @@ remakeForm.addEventListener("submit", event => { event.preventDefault(); const kind = document.getElementById("remake-kind").value; const settle = document.getElementById("remake-settle").value.trim(); + const switchDelay = document.getElementById("remake-switch-delay").value.trim(); + const force = document.getElementById("remake-force-switch-delay").checked + ? "force=switchDelay" : ""; let request; if (kind === "import") { // The document as it is (octet-stream): its options in the query. const file = document.getElementById("remake-import-file").files[0]; if (!file) { remakeResult("Choose the Automerge document to import.", true); return; } - const options = new URLSearchParams(); + const options = new URLSearchParams(force); if (settle) options.set("settle", settle); + if (switchDelay) options.set("switchDelay", switchDelay); const rules = remakeRules(); if (rules.length) options.set("rules", JSON.stringify(rules)); const query = options.size ? "?" + options : ""; @@ -2962,6 +2970,7 @@ remakeForm.addEventListener("submit", event => { } else { const body = { kind }; if (settle) body.settle = settle; + if (switchDelay) body.switchDelay = switchDelay; if (kind === "replace") { let parsed; try { @@ -2974,7 +2983,7 @@ remakeForm.addEventListener("submit", event => { const rules = remakeRules(); if (rules.length) body.spec.rules = rules; } - request = fetch("remakes", { method: "POST", body: JSON.stringify(body), + request = fetch("remakes" + (force ? "?" + force : ""), { method: "POST", body: JSON.stringify(body), headers: { "Content-Type": "application/json" } }); } remakeResult("Proposing…", false); @@ -2986,7 +2995,8 @@ remakeForm.addEventListener("submit", event => { ". The map shows the votes as they come.", false); } else { remakeResult(response.status + ": " + (report.error || response.statusText) + - (report.force ? " (the API takes ?force=" + report.force + ")" : ""), true); + (report.force === "switchDelay" ? " (tick \u201ceven below a keepalive interval\u201d)" + : report.force ? " (the API takes ?force=" + report.force + ")" : ""), true); } }) .catch(error => remakeResult("Proposing failed: " + error, true)); |
