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.
This commit is contained in:
parent
9a29845f89
commit
f23223f16d
1 changed files with 11 additions and 11 deletions
|
|
@ -750,7 +750,7 @@ WHERE job_id = $1"
|
||||||
(build-derivations store (list derivation)))
|
(build-derivations store (list derivation)))
|
||||||
(derivation->output-path 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?
|
(define use-container? (defined?
|
||||||
'open-inferior/container
|
'open-inferior/container
|
||||||
(resolve-module '(guix inferior))))
|
(resolve-module '(guix inferior))))
|
||||||
|
|
@ -852,9 +852,15 @@ WHERE job_id = $1"
|
||||||
inferior))
|
inferior))
|
||||||
|
|
||||||
(let ((channel-instance
|
(let ((channel-instance
|
||||||
(first
|
;; Obtain a session level lock here, to avoid conflicts with
|
||||||
(latest-channel-instances store
|
;; other jobs over the Git repository.
|
||||||
(list channel)))))
|
(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)
|
(inferior-eval '(use-modules (srfi srfi-1)
|
||||||
(guix channels)
|
(guix channels)
|
||||||
(guix grafts)
|
(guix grafts)
|
||||||
|
|
@ -897,13 +903,7 @@ WHERE job_id = $1"
|
||||||
(define (channel->derivations-by-system conn store channel)
|
(define (channel->derivations-by-system conn store channel)
|
||||||
(let* ((derivation-file-names-by-system
|
(let* ((derivation-file-names-by-system
|
||||||
(with-time-logging "computing the channel derivation"
|
(with-time-logging "computing the channel derivation"
|
||||||
;; Obtain a session level lock here, to avoid conflicts with
|
(channel->derivation-file-names-by-system conn store channel))))
|
||||||
;; 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))))))
|
|
||||||
(for-each
|
(for-each
|
||||||
(match-lambda
|
(match-lambda
|
||||||
((system . derivation-file-name)
|
((system . derivation-file-name)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue