From b4c2f7d20b649ab66962a957f6e9a7f3a03c68ab Mon Sep 17 00:00:00 2001 From: ruv Date: Wed, 29 Apr 2026 20:24:38 -0400 Subject: [PATCH] fix(pointcloud): stop polling /api/splats on Pages after first 404 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the viewer is hosted on a static origin (GitHub Pages, S3) it has no backend at /api/splats. The default ?backend=auto path was issuing a fetch every 100 ms, getting a 404, falling back to the demo, and flooding the console with one 404 per tick. Cosmetic on the surface but real network/CPU waste over time. After the first 404 in auto mode, set networkDisabled=true and skip fetch on subsequent ticks — the interval still fires but goes straight to pickDemoFrame() so the face mesh / synthetic render path keeps animating. Remote (?backend=) and live (?live=1) modes keep retrying so a transient outage doesn't permanently downgrade them. Co-Authored-By: claude-flow --- v2/crates/wifi-densepose-pointcloud/src/viewer.html | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/v2/crates/wifi-densepose-pointcloud/src/viewer.html b/v2/crates/wifi-densepose-pointcloud/src/viewer.html index 6040fa17..067abd2a 100644 --- a/v2/crates/wifi-densepose-pointcloud/src/viewer.html +++ b/v2/crates/wifi-densepose-pointcloud/src/viewer.html @@ -461,9 +461,15 @@ return faceMeshFrame() || syntheticFrame(); } + // Once auto mode confirms there is no /api/splats backend on this origin, + // set this flag so we stop hammering the network with 404 fetches every + // tick. Remote (?backend=) and live (?live=1) modes keep retrying so + // a transient outage doesn't permanently downgrade them. + var networkDisabled = false; + async function fetchCloud() { // Demo-only mode: never hit the network. - if (backendArg === "demo") { + if (backendArg === "demo" || networkDisabled) { transportMode = "demo"; handleData(pickDemoFrame()); return; @@ -480,6 +486,9 @@ '● OFFLINE
Live backend required (?live=1) but unreachable.
' + (err && err.message ? err.message : err) + ''; return; } + // Auto mode + first failure → assume this is a static host (Pages) + // and stop polling. Console stays clean; demo renders locally. + if (backendArg === "auto") networkDisabled = true; transportMode = "demo"; handleData(pickDemoFrame()); }