Pulse/internal/updates
Claude cc46e3c6f0
Refactor update service to eliminate polling and race conditions
This commit implements a comprehensive refactoring of the update system
to address race conditions, redundant polling, and rate limiting issues.

Backend changes:
- Add job queue system to ensure only ONE update runs at a time
- Implement Server-Sent Events (SSE) for real-time update progress
- Add rate limiting to /api/updates/status (5-second minimum per client)
- Create SSE broadcaster for push-based status updates
- Integrate job queue with update manager for atomic operations
- Add comprehensive unit tests for queue and SSE components

Frontend changes:
- Update UpdateProgressModal to use SSE as primary mechanism
- Implement automatic fallback to polling when SSE unavailable
- Maintain backward compatibility with existing update flow
- Clean up SSE connections on component unmount

API changes:
- Add new endpoint: GET /api/updates/stream (SSE)
- Enhance /api/updates/status with client-based rate limiting
- Return cached status with appropriate headers when rate limited

Benefits:
- Eliminates 429 rate limit errors during updates
- Only one update job can run at a time (prevents race conditions)
- Real-time updates via SSE reduce unnecessary polling
- Graceful degradation to polling when SSE unavailable
- Better resource utilization and reduced server load

Testing:
- All existing tests pass
- New unit tests for queue and SSE functionality
- Integration tests verify complete update flow
2025-11-11 09:33:05 +00:00
..
adapter_installsh.go Fix critical rollback download URL bug and doc inconsistencies 2025-11-06 14:25:32 +00:00
history.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
manager.go Refactor update service to eliminate polling and race conditions 2025-11-11 09:33:05 +00:00
manager_test.go Refactor update service to eliminate polling and race conditions 2025-11-11 09:33:05 +00:00
queue.go Refactor update service to eliminate polling and race conditions 2025-11-11 09:33:05 +00:00
queue_test.go Refactor update service to eliminate polling and race conditions 2025-11-11 09:33:05 +00:00
sse.go Refactor update service to eliminate polling and race conditions 2025-11-11 09:33:05 +00:00
sse_test.go Refactor update service to eliminate polling and race conditions 2025-11-11 09:33:05 +00:00
updater.go Fix settings security tab navigation 2025-10-11 23:29:47 +00:00
version.go feat: finalize swarm service monitoring (#598) 2025-10-26 09:35:49 +00:00
version_test.go feat: add docker agent command handling 2025-10-15 19:27:19 +00:00