feat(J): WebSocket live-events + replace polling + fix ffmpeg turntable timeout

- fix(render): ffmpeg overlay=0:0 -> overlay=0:0:shortest=1 to prevent hang on finite PNG sequences
- feat(ws): add core/websocket.py ConnectionManager + Redis Pub/Sub subscriber loop
- feat(ws): add /api/ws WebSocket endpoint with JWT query-param auth in main.py
- feat(ws): emit render_complete/failed + cad_processing_complete events from step_tasks.py
- feat(ws): emit order_status_change events from orders router
- feat(ws): add beat_tasks.py broadcast_queue_status task (every 10s via Redis __broadcast__)
- feat(frontend): add useWebSocket hook with auto-reconnect (exponential backoff, 25s ping)
- feat(frontend): add WebSocketContext + WebSocketProvider wrapping App
- refactor(frontend): remove polling from WorkerActivity (was 5s/3s) + OrderDetail (was 5s)
- refactor(frontend): reduce polling in Layout (8s->60s) + NotificationCenter (15s->60s)
- docs: add ffmpeg shortest=1 + WebSocket JWT auth learnings to LEARNINGS.md

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-06 20:49:34 +01:00
parent ceb0143cb6
commit 7a1329958d
16 changed files with 909 additions and 16 deletions
+2 -2
View File
@@ -23,8 +23,8 @@ export default function Layout() {
const { data: activity } = useQuery({
queryKey: ['worker-activity'],
queryFn: getWorkerActivity,
refetchInterval: 8000,
staleTime: 4000,
refetchInterval: 60_000,
staleTime: 30_000,
})
const { data: draftOrders } = useQuery({
@@ -81,7 +81,7 @@ export default function NotificationCenter() {
const { data: unreadCount = 0 } = useQuery({
queryKey: ['notifications', 'unread-count'],
queryFn: getUnreadCount,
refetchInterval: 15_000,
refetchInterval: 60_000,
staleTime: 5_000,
})
@@ -203,7 +203,7 @@ export default function NotificationCenter() {
<p className={clsx('text-sm', !n.read_at ? 'font-medium text-content' : 'text-content-secondary')}>
{cfg.label(n.details)}
</p>
{n.details?.error && (
{!!n.details?.error && (
<p className="mt-1 text-xs text-red-600 font-mono bg-red-50 rounded px-1.5 py-0.5 truncate">
{String(n.details.error)}
</p>