You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* fix: remove _worker_id to fix race condition in job processing
The client was storing _worker_id from server responses, but this caused
a race condition during socket reconnection:
1. Socket reconnects with NEW sid
2. Server assigns pending job to NEW sid
3. Socket event handler receives job:assign
4. But _worker_id still holds OLD value (not yet updated)
5. Worker sends wrong worker_id to server → 400 BAD REQUEST
The fix removes _worker_id entirely and always uses socket.sio.sid
directly. This is safe because:
- The server always assigns jobs to the socket's current sid
- The socket that receives job:assign is always the one with that sid
- socket.sio.sid always reflects the current connection
Changes:
- Remove _worker_id field from ZnDraw dataclass
- Simplify sid property to return socket.sio.sid directly
- Remove worker_id storage in socket_manager._register_extensions_after_join
- Update tests to use vis.sid instead of vis._worker_id
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: remove unused workerId return from registration methods
The register_extension() and register_filesystem() methods in
api_manager.py were returning workerId from server responses, but
callers no longer use this value after removing _worker_id storage.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* feat: add ASSIGNED job timeout with lazy cleanup
Jobs stuck in ASSIGNED state for more than 30 seconds are now
automatically failed during job listing. This handles cases where
a worker disconnects before confirming the job.
Changes:
- Add cleanup_stale_assigned_jobs() to JobManager
- Call cleanup lazily during list_active_jobs()
- Add error and workerId fields to job API response
- Convert Job class to dataclass with proper type hints
- Add tests for timeout behavior
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix: use assigned_at timestamp for job timeout instead of created_at
- Add assigned_at timestamp when job transitions to ASSIGNED state
- Update cleanup_stale_assigned_jobs() to use assigned_at (with fallback
to created_at for backwards compatibility)
- Update test to verify assigned_at is used for timeout calculation
This fixes the issue where a job that waited in PENDING state would
incorrectly timeout immediately upon assignment.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* fix
* auto-refresh / fix bug
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
0 commit comments