villebro opened a new pull request, #43792: URL: https://github.com/apache/superset/pull/43792
### SUMMARY Follow-up to #43782 (reviewer-requested): treat the `superset-websocket` server's Redis Pub/Sub subscriber health as part of the transport's readiness. The server's Redis subscriber is its **only** source of realtime messages. If that subscriber connection drops, a browser socket can stay **open** while the server silently misses every message published during the gap (until ioredis reconnects and re-subscribes) — a blind spot no client-side catch-up covers, because the client has no signal that anything went wrong and so never reconnects to run its `status_changes` reconciliation. This gates the transport on subscriber health: - **Health tracking.** `subscriberHealthy` flips **healthy** after a successful `subscribe(realtime)` — and on the subscriber connection's `ready` event, which fires after ioredis auto-reconnects and re-subscribes — and **unhealthy** on its `close`/`end`. - **Close sockets on the unhealthy edge.** When the subscriber drops, open sockets are closed with a retryable code (`1012` "Service Restart") so clients reconnect. The frontend already runs a `status_changes` catch-up on reconnect (from #43696 / #43782), so a server-initiated close plugs straight into existing recovery — no new client code. - **Refuse upgrades while unhealthy.** New upgrades get `503` so a client can't attach to a server that would miss its messages; the client's reconnect backoff retries until the server is healthy again. - **`/health` left as a liveness probe.** Deliberately *not* gated on subscriber health — coupling liveness to a transient Redis blip would churn pods. The functional guarantee comes from the upgrade-refusal + socket-close behavior, not from failing liveness. Node-only change (`superset-websocket`); no frontend or Python changes. ### TESTING INSTRUCTIONS ```bash npm --prefix superset-websocket run lint # eslint + tsc npm --prefix superset-websocket test # vitest (82 passing, incl. 4 new) ``` New tests cover: the unhealthy edge closes open sockets with `1012`; repeated unhealthy transitions are a no-op (edge-only); upgrades are refused with `503` while unhealthy; and recovery (`markSubscriberHealthy`) lets upgrades proceed again. Manual: with `WEBSOCKET_ENABLE` on and a chart loading, bounce Redis (or block the ws server's Redis connection): open sockets close and the browser reconnects; while Redis is down, new upgrades get `503`; once Redis returns, the socket reconnects and the chart resolves via the catch-up. ### ADDITIONAL INFORMATION - [ ] Has associated issue: - [x] Required feature flags: `WEBSOCKET_ENABLE` (realtime transport) - [ ] Changes UI - [ ] Includes DB Migration - [ ] Introduces new feature or API - [ ] Removes existing feature or API -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
