Skip to content

fix(assets): delay connection-loss recovery - #373

Merged
linkdata merged 2 commits into
mainfrom
fix/delay-connection-lost-banner
Aug 21, 2026
Merged

fix(assets): delay connection-loss recovery#373
linkdata merged 2 commits into
mainfrom
fix/delay-connection-lost-banner

Conversation

@linkdata

@linkdata linkdata commented Aug 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • wait five seconds after a WebSocket failure before the first readiness probe
  • show the connection-lost banner only when that probe does not trigger an immediate reload
  • use the reconnect state as the cancellation guard, so pagehide makes delayed timer and XHR callbacks inert
  • add Node-backed regressions for the grace boundary, duplicate failure events, probe outcomes, scroll preservation, and the failure-before-pagehide race

Behavior and tradeoffs

This is intentionally a fixed grace-period heuristic, not navigation tracking.

  • A genuine connection loss takes five seconds longer to probe. If the first probe stalls until its ten-second timeout, the banner can appear roughly 15 seconds after failure.
  • A refresh, redirect, or cross-document form GET/POST that commits within five seconds remains quiet. If it leaves the old document active longer, the old page can still show the banner or be superseded by a reconnect-triggered reload before pagehide.
  • Background fetch/XHR work is not navigation and is unaffected unless the WebSocket independently fails.
  • The existing 60-second minimum page age and elapsed-time backoff remain. After a failure on a fresh page, healthy probes can occur around 5, 10, 20, 40, and 80 seconds before reload is allowed.

Testing

  • node --check lib/assets/jaws.js
  • go vet ./...
  • gofmt -l .
  • staticcheck ./...
  • golangci-lint run
  • gosec ./...
  • go build ./...
  • go test -race ./...

@linkdata
linkdata merged commit 36cdba9 into main Aug 21, 2026
7 checks passed
@linkdata
linkdata deleted the fix/delay-connection-lost-banner branch August 21, 2026 10:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant