Skip to content

Commit

Permalink
Don't print error when job is gone after chan
Browse files Browse the repository at this point in the history
  • Loading branch information
fridim committed Sep 28, 2023
1 parent df9f464 commit 75002cc
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions cmd/sandbox-api/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
"github.com/aws/aws-sdk-go-v2/credentials"
"github.com/aws/aws-sdk-go-v2/service/sts"
"github.com/jackc/pgx/v4/pgxpool"
"github.com/jackc/pgx/v4"
)

type Worker struct {
Expand Down Expand Up @@ -106,6 +107,10 @@ WorkerLoop:
}
job, err := models.GetLifecycleResourceJob(w.Dbpool, id)
if err != nil {
if err == pgx.ErrNoRows {
log.Logger.Debug("Resource job not found", "job", job)
continue WorkerLoop
}
log.Logger.Error("Error getting lifecycle resource job", "error", err)
continue WorkerLoop
}
Expand All @@ -121,6 +126,10 @@ WorkerLoop:

job, err = models.GetLifecycleResourceJob(w.Dbpool, id)
if err != nil {
if err == pgx.ErrNoRows {
log.Logger.Debug("Resource job not found", "job", job)
continue WorkerLoop
}
log.Logger.Error("Error getting lifecycle placement job", "error", err)
continue WorkerLoop
}
Expand Down Expand Up @@ -156,6 +165,10 @@ WorkerLoop:
}
job, err := models.GetLifecyclePlacementJob(w.Dbpool, id)
if err != nil {
if err == pgx.ErrNoRows {
log.Logger.Debug("Placement job not found", "job", job)
continue WorkerLoop
}
log.Logger.Error("Error getting lifecycle placement job", "error", err)
continue WorkerLoop
}
Expand All @@ -172,6 +185,10 @@ WorkerLoop:

job, err = models.GetLifecyclePlacementJob(w.Dbpool, id)
if err != nil {
if err == pgx.ErrNoRows {
log.Logger.Debug("Placement job not found", "job", job)
continue WorkerLoop
}
log.Logger.Error("Error getting lifecycle placement job", "error", err)
continue WorkerLoop
}
Expand Down

0 comments on commit 75002cc

Please sign in to comment.