Make a container action tell the truth about what happened

The response was discarded, so a refused stop looked like a completed one, and the payload the
card redraws from is cached for 300s with no invalidation — the container carried on showing as
running until the once-a-minute writer caught up. Stop now confirms; start still does not.
This commit is contained in:
Gmer4Lfe
2026-08-07 10:20:11 -04:00
parent fb50f94ed8
commit b445ddc2c8
4 changed files with 52 additions and 4 deletions
+11
View File
@@ -456,6 +456,17 @@ function vv_cache_write(string $key, array $data): void {
rename($tmp, $f);
}
// Drop a cached payload so the next read collects fresh. For use by endpoints that change the
// very state a cache describes: without it the UI polls a payload that cannot yet know about the
// action it just took, and the operator sees a container they stopped still running until the
// background writer next comes round.
//
// Best-effort by design. A cache that could not be removed is a stale read, which is what would
// have happened anyway — never a reason to fail the action that was actually requested.
function vv_cache_clear(string $key): void {
@unlink(VV_CACHE_DIR . '/' . $key . '.json');
}
// ── Shared utility functions (used across include/ and api/ files) ────────────
// Format seconds into "2d 3h 15m".