This commit is contained in:
parent
8046093e9e
commit
2dec6a6271
1 changed files with 22 additions and 15 deletions
|
@ -390,6 +390,7 @@ func assignQueuedTasks(ctx context.Context) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = rpcServer.Call(ctx, Workers[i].Conn, "task-start", taskStart, nil)
|
_, err = rpcServer.Call(ctx, Workers[i].Conn, "task-start", taskStart, nil)
|
||||||
|
if err != nil {
|
||||||
if strings.HasSuffix(err.Error(), constants.ErrTaskIsAlreadyRunning.Error()) {
|
if strings.HasSuffix(err.Error(), constants.ErrTaskIsAlreadyRunning.Error()) {
|
||||||
// Task was started previously but something went wrong and we are out of sync
|
// Task was started previously but something went wrong and we are out of sync
|
||||||
slog.WarnContext(ctx, "Task is apparently already Running on this Worker, thats bad", "task_id", taskStart.ID, "worker", Workers[i].Name)
|
slog.WarnContext(ctx, "Task is apparently already Running on this Worker, thats bad", "task_id", taskStart.ID, "worker", Workers[i].Name)
|
||||||
|
@ -406,8 +407,14 @@ func assignQueuedTasks(ctx context.Context) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Updating Unknown Task Status due to Timeout while starting Task: %w", err)
|
return fmt.Errorf("Updating Unknown Task Status due to Timeout while starting Task: %w", err)
|
||||||
}
|
}
|
||||||
} else if err != nil {
|
} else {
|
||||||
return fmt.Errorf("Error Starting Task: %w", err)
|
slog.ErrorContext(ctx, "Task start Error", "task_id", taskStart.ID, "worker", Workers[i].Name)
|
||||||
|
|
||||||
|
_, err = db.Exec(ctx, "UPDATE tasks SET status = $2, log = log || $3 WHERE id = $1", taskStart.ID, constants.TASK_STATUS_UNKNOWN, []string{fmt.Sprintf("%v MASTER: Task Start Error: %v", time.Now(), err.Error())})
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("Updating Unknown Task Status due to Error while starting Task: %w", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tx.Commit(ctx)
|
err = tx.Commit(ctx)
|
||||||
|
|
Loading…
Add table
Reference in a new issue