dbjobqueue: Filter maintenance queries based on results
Jobs that already had their results nulled, shouldn't be included in the maintenance job.
This commit is contained in:
parent
4827f0e83e
commit
8bfc6c9961
2 changed files with 2 additions and 2 deletions
|
|
@ -74,7 +74,7 @@ func setFinishedAt(t *testing.T, q *dbjobqueue.DBJobQueue, id uuid.UUID, finishe
|
|||
started := finished.Add(-time.Second)
|
||||
queued := started.Add(-time.Second)
|
||||
|
||||
_, err = conn.Exec(context.Background(), "UPDATE jobs SET queued_at = $1, started_at = $2, finished_at = $3 WHERE id = $4", queued, started, finished, id)
|
||||
_, err = conn.Exec(context.Background(), "UPDATE jobs SET queued_at = $1, started_at = $2, finished_at = $3, result = '{\"result\": \"success\" }' WHERE id = $4", queued, started, finished, id)
|
||||
require.NoError(t, err)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ const (
|
|||
sqlQueryJobsUptoByType = `
|
||||
SELECT array_agg(id), type
|
||||
FROM jobs
|
||||
WHERE type = ANY($1) AND finished_at < $2
|
||||
WHERE type = ANY($1) AND finished_at < $2 AND result IS NOT NULL
|
||||
GROUP BY type`
|
||||
sqlDeleteJobResult = `
|
||||
UPDATE jobs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue