Refactor job status handling to prevent race conditions
All checks were successful
PR Check / check-and-test (pull_request) Successful in 26s

- Removed redundant error handling in handleListJobTasks.
- Introduced per-job mutexes in Manager to serialize updateJobStatusFromTasks calls, ensuring thread safety during concurrent task completions.
- Added methods to manage job status update mutexes, including creation and cleanup after job completion or failure.
- Improved error handling in handleGetJobStatusForRunner by consolidating error checks.
This commit is contained in:
2026-01-02 18:22:55 -06:00
parent 8e561922c9
commit b51b96a618
3 changed files with 43 additions and 12 deletions

View File

@@ -3024,9 +3024,6 @@ func (s *Manager) handleListJobTasks(w http.ResponseWriter, r *http.Request) {
return
}
defer rows.Close()
if err != nil {
total = -1
}
tasks := []types.Task{}
for rows.Next() {