Add Logging
This commit is contained in:
parent
93cd12c6b6
commit
3dfb113aaf
1 changed files with 4 additions and 3 deletions
|
@ -204,13 +204,14 @@ func updateWorkerTaskStatus(ctx context.Context) {
|
|||
// Find better way to compare errors which where send via websocket
|
||||
if strings.HasSuffix(err.Error(), constants.ErrTaskDoesNotExist.Error()) {
|
||||
// Worker says it does not know of this task, mark it failed so that we don't asks the worker about it again and again
|
||||
slog.ErrorContext(ctx, "Task is unknown by worker, Failing...", "err", err)
|
||||
|
||||
_, err = db.Exec(ctx, "UPDATE tasks SET status = $2, log = log || $3 WHERE id = $1", ts.Task.ID, constants.TASK_STATUS_FAILED, []string{"Task Failed because it is unkown to Assigned Worker"})
|
||||
slog.ErrorContext(ctx, "Task is unknown by worker, Failing...", "err", err, "id", ts.Task.ID)
|
||||
_, err = db.Exec(ctx, "UPDATE tasks SET status = $2, log = log || $3 WHERE id = $1", ts.Task.ID, constants.TASK_STATUS_FAILED, []string{"Task Failed because it is unknown to Assigned Worker"})
|
||||
if err != nil {
|
||||
slog.ErrorContext(ctx, "Updating Failed Task Status", "err", err)
|
||||
return
|
||||
}
|
||||
slog.Info("Updating task done", "id", ts.Task.ID, "status", constants.TASK_STATUS_FAILED)
|
||||
|
||||
return
|
||||
} else if err != nil {
|
||||
slog.ErrorContext(ctx, "Getting Task Status", "err", err)
|
||||
|
|
Loading…
Add table
Reference in a new issue