dbjobqueue: remove unused variables from Dequeue

Removing queued_at and started_at is pretty straightforward, it wasn't needed.
Removing token might seem concerning but basically we were just pulling
the same value from DB as we were pushing there. I think there's no value in
doing that.

Signed-off-by: Ondřej Budai <ondrej@budai.cz>
This commit is contained in:
Ondřej Budai 2022-03-07 15:17:25 +01:00 committed by Tom Gundersen
parent 318a4525c6
commit c8dbe0de74

View file

@ -41,7 +41,7 @@ const (
LIMIT 1
FOR UPDATE SKIP LOCKED
)
RETURNING id, token, type, args, queued_at, started_at`
RETURNING id, type, args`
sqlDequeueByID = `
UPDATE jobs
@ -213,10 +213,9 @@ func (q *DBJobQueue) Dequeue(ctx context.Context, jobTypes []string, channels []
var id uuid.UUID
var jobType string
var args json.RawMessage
var started, queued *time.Time
token := uuid.New()
for {
err = conn.QueryRow(ctx, sqlDequeue, token, jobTypes, channels).Scan(&id, &token, &jobType, &args, &queued, &started)
err = conn.QueryRow(ctx, sqlDequeue, token, jobTypes, channels).Scan(&id, &jobType, &args)
if err == nil {
break
}