aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-02-03 10:58:55 +0000
committerChristopher Baines <mail@cbaines.net>2021-02-03 10:58:55 +0000
commit481b1c186f04785a889d481aabc83d29fdea6200 (patch)
tree23ac1ff5ceec3d62b1cefbc91607b41cd926bf8f /guix-data-service/model
parent643753ff463694f0e894526e46460fecc6c5b696 (diff)
downloaddata-service-481b1c186f04785a889d481aabc83d29fdea6200.tar
data-service-481b1c186f04785a889d481aabc83d29fdea6200.tar.gz
Fix latest processed commit for branch
Diffstat (limited to 'guix-data-service/model')
-rw-r--r--guix-data-service/model/git-branch.scm22
1 files changed, 15 insertions, 7 deletions
diff --git a/guix-data-service/model/git-branch.scm b/guix-data-service/model/git-branch.scm
index 070931d..91d5ec6 100644
--- a/guix-data-service/model/git-branch.scm
+++ b/guix-data-service/model/git-branch.scm
@@ -118,13 +118,21 @@ WHERE git_branches.commit = $1")
(define* (latest-processed-commit-for-branch conn repository-id branch-name)
(define query
(string-append
- "SELECT git_branches.commit "
- "FROM git_branches "
- "INNER JOIN guix_revisions ON git_branches.commit = guix_revisions.commit "
- "WHERE guix_revisions.git_repository_id = $1 AND "
- "git_branches.git_repository_id = $1 AND git_branches.name = $2 "
- "ORDER BY datetime DESC "
- "LIMIT 1"))
+ "
+SELECT git_branches.commit
+FROM git_branches
+INNER JOIN guix_revisions
+ ON git_branches.commit = guix_revisions.commit
+INNER JOIN load_new_guix_revision_jobs
+ ON load_new_guix_revision_jobs.commit = guix_revisions.commit
+INNER JOIN load_new_guix_revision_job_events
+ ON job_id = load_new_guix_revision_jobs.id
+WHERE guix_revisions.git_repository_id = $1
+ AND git_branches.git_repository_id = $1
+ AND git_branches.name = $2
+ AND load_new_guix_revision_job_events.event = 'success'
+ORDER BY datetime DESC
+LIMIT 1"))
(match (exec-query
conn