mirror of
https://github.com/bulwarkmail/webmail.git
synced 2026-10-31 08:13:50 +00:00
Since the per-account push setup (#281), every account switch tears down and re-creates push notifications for all connected clients. Aborting an SSE connect that is still in flight lands in the fetch rejection handler, which treated it as a network failure: - fallbackToPolling() started an unsupervised 3s state poll on a client whose push had just been intentionally closed, after the cleanup that would have removed it had already run. - The late rejection also nulled sseAbortController, orphaning the replacement connection set up right after: it could never be aborted again and reconnected itself in parallel once the server closed it. Rapid switching multiplied both effects until the server's concurrency limit stalled the app entirely. Each connect attempt now tracks its own AbortController: an aborted attempt returns silently instead of falling back to polling, and the end-of-stream reconnect only fires if the stream is still the current one. Regression tests simulate the switch churn both ways.