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:
parent
9bb8f84741
commit
10bad53ad5
14 changed files with 328 additions and 53 deletions
|
|
@ -39,6 +39,7 @@
|
|||
check-test-database!
|
||||
|
||||
with-advisory-session-lock
|
||||
with-advisory-session-lock/log-time
|
||||
obtain-advisory-transaction-lock
|
||||
|
||||
exec-query-with-null-handling))
|
||||
|
|
@ -298,6 +299,22 @@
|
|||
"SELECT pg_advisory_unlock($1)"
|
||||
(list lock-number))))))
|
||||
|
||||
(define (with-advisory-session-lock/log-time conn lock f)
|
||||
(simple-format #t "debug: Acquiring advisory session lock: ~A\n" lock)
|
||||
(let ((start-time (current-time)))
|
||||
(with-advisory-session-lock
|
||||
conn
|
||||
lock
|
||||
(lambda ()
|
||||
(let ((time-taken (- (current-time) start-time)))
|
||||
(simple-format #t "debug: Finished aquiring lock ~A, took ~A seconds\n"
|
||||
lock time-taken))
|
||||
(let ((result (f)))
|
||||
(let ((time-spent (- (current-time) start-time)))
|
||||
(simple-format #t "debug: Releasing lock ~A, spent ~A seconds\n"
|
||||
lock time-spent))
|
||||
result)))))
|
||||
|
||||
(define (obtain-advisory-transaction-lock conn lock)
|
||||
(let ((lock-number (number->string (symbol-hash lock))))
|
||||
(exec-query conn
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue