fix error comparison

This commit is contained in:
speatzle 2024-05-21 16:37:52 +02:00
parent 971aa40615
commit d2212e2478

View file

@ -2,9 +2,9 @@ package server
import ( import (
"context" "context"
"errors"
"log/slog" "log/slog"
"net/http" "net/http"
"strings"
"sync" "sync"
"time" "time"
@ -200,7 +200,9 @@ func updateWorkerTaskStatus(ctx context.Context) {
defer wg.Done() defer wg.Done()
var ts types.TaskStatus var ts types.TaskStatus
_, err := rpcServer.Call(ctx, w.Conn, "task-status", tsr, &ts) _, err := rpcServer.Call(ctx, w.Conn, "task-status", tsr, &ts)
if errors.Is(err, constants.ErrTaskDoesNotExist) {
// 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 // 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 unkown by worker, Failing...", "err", err) slog.ErrorContext(ctx, "Task is unkown by worker, Failing...", "err", err)