diff options
author | Christopher Baines <mail@cbaines.net> | 2020-02-28 20:40:31 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2020-02-28 20:40:31 +0000 |
commit | f23223f16d8f532a60824d88a45deaa23ec43be2 (patch) | |
tree | f49be7265f0bb576a1701b5705bd55a34eaff6cb /guix-data-service | |
parent | 9a29845f89590dac84cfe1bdadf4aab7f4e78d8c (diff) | |
download | data-service-f23223f16d8f532a60824d88a45deaa23ec43be2.tar data-service-f23223f16d8f532a60824d88a45deaa23ec43be2.tar.gz |
Improve the locking around fetching channel instances
I think there's still the potential for a race condition when working with the
cached checkout of the repository, but this lock was far too wide. The
sensitive section is just the latest-channel-instances call, as it adds the
relevant files to the store, and that's what's returned.
Diffstat (limited to 'guix-data-service')
-rw-r--r-- | guix-data-service/jobs/load-new-guix-revision.scm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/guix-data-service/jobs/load-new-guix-revision.scm b/guix-data-service/jobs/load-new-guix-revision.scm index 8c154eb..0f9cbba 100644 --- a/guix-data-service/jobs/load-new-guix-revision.scm +++ b/guix-data-service/jobs/load-new-guix-revision.scm @@ -750,7 +750,7 @@ WHERE job_id = $1" (build-derivations store (list derivation))) (derivation->output-path derivation))) -(define (channel->derivation-file-names-by-system store channel) +(define (channel->derivation-file-names-by-system conn store channel) (define use-container? (defined? 'open-inferior/container (resolve-module '(guix inferior)))) @@ -852,9 +852,15 @@ WHERE job_id = $1" inferior)) (let ((channel-instance - (first - (latest-channel-instances store - (list channel))))) + ;; Obtain a session level lock here, to avoid conflicts with + ;; other jobs over the Git repository. + (with-advisory-session-lock/log-time + conn + 'latest-channel-instances + (lambda () + (first + (latest-channel-instances store + (list channel))))))) (inferior-eval '(use-modules (srfi srfi-1) (guix channels) (guix grafts) @@ -897,13 +903,7 @@ WHERE job_id = $1" (define (channel->derivations-by-system conn store channel) (let* ((derivation-file-names-by-system (with-time-logging "computing the channel derivation" - ;; Obtain a session level lock here, to avoid conflicts with - ;; other jobs over the Git repository. - (with-advisory-session-lock/log-time - conn - 'channel->manifest-store-item - (lambda () - (channel->derivation-file-names-by-system store channel)))))) + (channel->derivation-file-names-by-system conn store channel)))) (for-each (match-lambda ((system . derivation-file-name) |