Merge pull request #10 from naturallaw777/copilot/fix-rebuild-modal-race-condition

Fix stale rebuild modal race condition in Features Manager
This commit is contained in:
Sovran_Systems
2026-04-02 20:41:28 -05:00
committed by GitHub
2 changed files with 8 additions and 1 deletions

View File

@@ -950,6 +950,12 @@ async def api_features_toggle(req: FeatureToggleRequest):
await loop.run_in_executor(None, _write_hub_overrides, features, nostr_npub) await loop.run_in_executor(None, _write_hub_overrides, features, nostr_npub)
# Clear the old rebuild log so the frontend doesn't pick up stale results
try:
open(REBUILD_LOG, "w").close()
except OSError:
pass
# Start the rebuild service # Start the rebuild service
await asyncio.create_subprocess_exec( await asyncio.create_subprocess_exec(
"systemctl", "reset-failed", REBUILD_UNIT, "systemctl", "reset-failed", REBUILD_UNIT,

View File

@@ -543,7 +543,8 @@ function openRebuildModal() {
if ($rebuildSave) $rebuildSave.style.display = "none"; if ($rebuildSave) $rebuildSave.style.display = "none";
if ($rebuildClose) $rebuildClose.disabled = true; if ($rebuildClose) $rebuildClose.disabled = true;
$rebuildModal.classList.add("open"); $rebuildModal.classList.add("open");
startRebuildPoll(); // Delay first poll slightly to let the rebuild service start and clear stale log
setTimeout(startRebuildPoll, 1500);
} }
function closeRebuildModal() { function closeRebuildModal() {