From 3dfb113aaf0af324356d70f11b8b7adac7e54a83 Mon Sep 17 00:00:00 2001 From: speatzle Date: Tue, 21 May 2024 16:52:31 +0200 Subject: [PATCH] Add Logging --- server/worker.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/server/worker.go b/server/worker.go index 7f6750e..0e210c9 100644 --- a/server/worker.go +++ b/server/worker.go @@ -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)