Skip to content

SSE connection limits — replace with polling or WebSocket #12

@howwohmm

Description

@howwohmm

Problem

`main.py:214-247` — each enrollment opens an SSE stream that polls the DB every 5 seconds for up to 30 minutes. At 100 concurrent enrollments = 100 persistent connections, each hitting the DB every 5s.

Solution

  • Replace SSE with client-side polling (exponential backoff: 2s → 5s → 10s → 30s)
  • Or use WebSocket with server-push on actual state changes
  • Add max concurrent SSE connections guard

Files

  • `main.py` — SSE endpoint (lines 214-247)

Acceptance Criteria

  • No long-lived connections per enrollment
  • DB polling reduced by 90%+

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — operational painscaling1K DAU scaling work

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions