Bug Summary
Each active SSE connection starts a recurring polling loop that performs database queries every few seconds.
There is currently no per-user connection limit, allowing a single authenticated user to create significant database load.
Describe the bug
The SSE endpoint creates a polling interval for every active connection.
Each interval repeatedly queries application data for the lifetime of the connection.
Multiple browser tabs, refresh loops, or automated clients can create many concurrent polling streams.
Because connection count is not restricted, database activity scales linearly with the number of open connections.
To Reproduce
- Authenticate normally.
- Open multiple browser tabs that connect to the SSE endpoint.
- Observe multiple concurrent SSE connections.
- Monitor database activity.
- Observe repeated query execution for each connection.
Expected behavior
The system should limit concurrent SSE connections per user or use a more efficient subscription model.
Actual behavior
Every connection creates an independent polling loop.
Additional context
Affected file:
src/app/api/stream/route.ts
Potential impact:
- excessive database usage
- degraded application performance
- unnecessary resource consumption
- increased operational costs
This issue becomes more noticeable under heavy dashboard usage or multi-tab sessions.
Bug Summary
Each active SSE connection starts a recurring polling loop that performs database queries every few seconds.
There is currently no per-user connection limit, allowing a single authenticated user to create significant database load.
Describe the bug
The SSE endpoint creates a polling interval for every active connection.
Each interval repeatedly queries application data for the lifetime of the connection.
Multiple browser tabs, refresh loops, or automated clients can create many concurrent polling streams.
Because connection count is not restricted, database activity scales linearly with the number of open connections.
To Reproduce
Expected behavior
The system should limit concurrent SSE connections per user or use a more efficient subscription model.
Actual behavior
Every connection creates an independent polling loop.
Additional context
Affected file:
src/app/api/stream/route.ts
Potential impact:
This issue becomes more noticeable under heavy dashboard usage or multi-tab sessions.