Support polling git repositories for new branches/revisions

This is mostly a workaround for the occasional problems with the guix-commits
mailing list, as it can break and then the data service doesn't learn about
new revisions until the problem is fixed.

I think it's still a generally good feature though, and allows deploying the
data service without it consuming emails to learn about new revisions, and is
a step towards integrating some kind of way of notifying the data service to
poll.
This commit is contained in:
Christopher Baines 2023-10-09 21:29:58 +01:00
parent 9bb8f84741
commit 10bad53ad5
14 changed files with 328 additions and 53 deletions

View file

@ -21,7 +21,8 @@
#:use-module (squee)
#:use-module (srfi srfi-19)
#:use-module (guix-data-service model utils)
#:export (insert-git-commit-entry))
#:export (insert-git-commit-entry
git-commit-exists?))
(define (insert-git-commit-entry conn
git-branch-id
@ -36,3 +37,11 @@ ON CONFLICT DO NOTHING"
(list commit
(number->string git-branch-id)
(date->string datetime "~s"))))
(define (git-commit-exists? conn commit)
(match (exec-query
conn
"SELECT 1 FROM git_commits WHERE commit = $1"
(list commit))
(#f #f)
(_ #t)))