diff options
author | Christopher Baines <mail@cbaines.net> | 2019-07-12 19:52:50 +0100 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2019-07-12 19:56:58 +0100 |
commit | 05c828796514b7bcd8a613da8ab1d6a5402931fa (patch) | |
tree | 0ae0c2a20996f9b2cd2bbb455c4354d23565a405 /guix-data-service/jobs/load-new-guix-revision.scm | |
parent | fde1000cb3a703c7d0ac5717b79461bc5c5732f9 (diff) | |
download | data-service-05c828796514b7bcd8a613da8ab1d6a5402931fa.tar data-service-05c828796514b7bcd8a613da8ab1d6a5402931fa.tar.gz |
Lock around the channel fetch when loading new revisions
This is in preparation for running jobs in parallel. The channels code in Guix
uses a cached copy of the Git repository. Multiple jobs can't concurrently
access this without causing issues, so use an advisory lock to ensure that
only one job is using the repository at a time.
Diffstat (limited to 'guix-data-service/jobs/load-new-guix-revision.scm')
-rw-r--r-- | guix-data-service/jobs/load-new-guix-revision.scm | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index 8c53183..401a2c7 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -482,12 +482,18 @@ (close-inferior inferior) #f)))) -(define (channel->manifest-store-item store channel) +(define (channel->manifest-store-item conn store channel) (let* ((manifest-store-item-derivation-file-name (log-time "computing the channel derivation" (lambda () - (channel->derivation-file-name store channel)))) + ;; Obtain a session level lock here, to avoid conflicts with + ;; other jobs over the Git repository. + (with-advisory-session-lock + conn + 'channel->manifest-store-item + (lambda () + (channel->derivation-file-name store channel)))))) (derivation (read-derivation-from-file manifest-store-item-derivation-file-name))) (log-time @@ -496,13 +502,14 @@ (build-derivations store (list derivation)))) (derivation->output-path derivation))) -(define (channel->guix-store-item store channel) +(define (channel->guix-store-item conn store channel) (catch #t (lambda () (dirname (readlink - (string-append (channel->manifest-store-item store + (string-append (channel->manifest-store-item conn + store channel) "/bin")))) (lambda args @@ -573,6 +580,7 @@ (set-build-options store #:fallback? #t) (channel->guix-store-item + conn store (channel (name 'guix) (url (git-repository-id->url |