Make it easier to retry jobs

Add a new event 'retry', and run jobs where the number of retry events is
greater or equal to the number of failure events.

Also add an index to the git_branches table to make the finding jobs query a
bit faster.
This commit is contained in:
Christopher Baines 2019-10-02 21:54:11 +01:00
parent e00aabde43
commit 427063c812
5 changed files with 26 additions and 3 deletions

View file

@ -1130,10 +1130,13 @@ SELECT
FROM load_new_guix_revision_jobs
WHERE
succeeded_at IS NULL AND
NOT EXISTS (
SELECT 1
(
SELECT COUNT(*)
FROM load_new_guix_revision_job_events
WHERE job_id = load_new_guix_revision_jobs.id AND event = 'retry'
) >= (
SELECT COUNT(*)
FROM load_new_guix_revision_job_events
-- Skip jobs that have failed, to avoid trying them over and over again
WHERE job_id = load_new_guix_revision_jobs.id AND event = 'failure'
)
ORDER BY latest_branch_commit DESC, id DESC