Tweak inserting sources
To try and make it faster.
This commit is contained in:
parent
a4480ac357
commit
683b375d56
1 changed files with 57 additions and 38 deletions
|
|
@ -1093,17 +1093,36 @@
|
|||
derivation-ids
|
||||
#:key (log-tag "unspecified"))
|
||||
(with-time-logging
|
||||
(string-append "insert-missing-derivations: inserting sources (" log-tag ")")
|
||||
(fibers-for-each
|
||||
(lambda (derivation-id derivation)
|
||||
(let ((sources (derivation-sources derivation)))
|
||||
(unless (null? sources)
|
||||
(let ((sources-ids
|
||||
(string-append "insert-missing-derivations: inserting sources for "
|
||||
(number->string (vector-length derivations))
|
||||
" derivations (" log-tag ")")
|
||||
(let ((sources-ids-vector
|
||||
(with-resource-from-pool postgresql-connection-pool conn
|
||||
(with-time-logging
|
||||
(string-append
|
||||
"insert-missing-derivations: inserting "
|
||||
(number->string (vector-length derivations))
|
||||
" derivation_source_files and derivation_sources"
|
||||
" (" log-tag ")")
|
||||
(vector-map
|
||||
(lambda (_ derivation-id derivation)
|
||||
(let ((sources (derivation-sources derivation)))
|
||||
(if (null? sources)
|
||||
#()
|
||||
(insert-derivation-sources conn
|
||||
derivation-id
|
||||
sources))))
|
||||
derivation-ids
|
||||
derivations)))))
|
||||
(with-time-logging
|
||||
(string-append
|
||||
"insert-missing-derivations: inserting "
|
||||
(number->string (vector-length derivations))
|
||||
" derivation_source_file_nars"
|
||||
" (" log-tag ")")
|
||||
(fibers-for-each
|
||||
(lambda (derivation source-ids)
|
||||
(for-each
|
||||
(lambda (id source-file)
|
||||
(when
|
||||
(with-resource-from-pool postgresql-connection-pool conn
|
||||
|
|
@ -1129,10 +1148,10 @@ SELECT 1 FROM derivation_source_file_nars WHERE derivation_source_file_id = $1"
|
|||
postgresql-connection-pool
|
||||
id
|
||||
source-file)))))
|
||||
sources-ids
|
||||
sources)))))
|
||||
derivation-ids
|
||||
derivations)))
|
||||
(vector->list source-ids)
|
||||
(derivation-sources derivation)))
|
||||
derivations
|
||||
sources-ids-vector)))))
|
||||
|
||||
(define* (insert-missing-derivations postgresql-connection-pool
|
||||
call-with-utility-thread
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue