aboutsummaryrefslogtreecommitdiff
path: root/guix-data-service/model
diff options
context:
space:
mode:
authorChristopher Baines <mail@cbaines.net>2021-02-03 10:35:56 +0000
committerChristopher Baines <mail@cbaines.net>2021-02-03 10:35:56 +0000
commit643753ff463694f0e894526e46460fecc6c5b696 (patch)
treec3eb9932dad6b630c34510deca551870ac9b08ba /guix-data-service/model
parent7fbcb3a3c26906ee130bcc64e88ea7a2b390de2c (diff)
downloaddata-service-643753ff463694f0e894526e46460fecc6c5b696.tar
data-service-643753ff463694f0e894526e46460fecc6c5b696.tar.gz
Better handle retries for jobs
This was broken when the guix_revisions entry started being added before the final commit.
Diffstat (limited to 'guix-data-service/model')
-rw-r--r--guix-data-service/model/guix-revision.scm14
1 files changed, 14 insertions, 0 deletions
diff --git a/guix-data-service/model/guix-revision.scm b/guix-data-service/model/guix-revision.scm
index 4f5ed6d..f7dc26a 100644
--- a/guix-data-service/model/guix-revision.scm
+++ b/guix-data-service/model/guix-revision.scm
@@ -23,6 +23,7 @@
#:export (count-guix-revisions
most-recent-n-guix-revisions
commit->revision-id
+ git-repository-id-and-commit->revision-id
insert-guix-revision
guix-commit-exists?
guix-revision-exists?
@@ -46,6 +47,19 @@
id)
(() #f)))
+(define (git-repository-id-and-commit->revision-id conn git-repository-id commit)
+ (match (exec-query
+ conn
+ "
+SELECT id
+FROM guix_revisions
+WHERE commit = $1
+ AND git_repository_id = $2"
+ (list commit git-repository-id))
+ (((id))
+ id)
+ (() #f)))
+
(define (insert-guix-revision conn git-repository-id commit)
(define insert
"