Set Parallel Tasks, Respect which worker
All checks were successful
/ release (push) Successful in 47s
All checks were successful
/ release (push) Successful in 47s
This commit is contained in:
parent
1e4016d075
commit
e7371850d1
1 changed files with 12 additions and 4 deletions
|
@ -23,10 +23,18 @@ func HandleSetParallelTasks(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
slog.Info("Got set Parallel Tasks", "parallel_tasks", parallelTasks, "worker", worker)
|
||||
|
||||
_, err = db.Exec(r.Context(), "UPDATE workers SET parallel_tasks = $1", parallelTasks)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("Setting Worker Parallel Tasks: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
if worker == "all" {
|
||||
_, err = db.Exec(r.Context(), "UPDATE workers SET parallel_tasks = $1", parallelTasks)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("Setting Worker Parallel Tasks: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
} else {
|
||||
_, err = db.Exec(r.Context(), "UPDATE workers SET parallel_tasks = $1 where id = $2", parallelTasks, worker)
|
||||
if err != nil {
|
||||
http.Error(w, fmt.Sprintf("Setting Worker Parallel Tasks: %v", err), http.StatusInternalServerError)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
http.Redirect(w, r, r.Header.Get("Referer"), http.StatusFound)
|
||||
|
|
Loading…
Add table
Reference in a new issue