diff options
author | Christopher Baines <mail@cbaines.net> | 2022-03-11 13:07:34 +0000 |
---|---|---|
committer | Christopher Baines <mail@cbaines.net> | 2022-03-11 13:27:55 +0000 |
commit | 097e22ab5e8c59b0ffce1867a54eb0622ab75ce4 (patch) | |
tree | 916c64f8809f4782ba1f6a980f0930d30284d578 /guix-data-service/model | |
parent | df4e0a7a616fcea9c15f4c2af85680ab0e0ec55b (diff) | |
download | data-service-097e22ab5e8c59b0ffce1867a54eb0622ab75ce4.tar data-service-097e22ab5e8c59b0ffce1867a54eb0622ab75ce4.tar.gz |
Close the load revision inferior prior to inserting data
This means that the lock can be acquired after closing the inferior, freeing
the large amount of memory that the inferior process is probably using.
Diffstat (limited to 'guix-data-service/model')
-rw-r--r-- | guix-data-service/model/package-metadata.scm | 54 |
1 files changed, 25 insertions, 29 deletions
diff --git a/guix-data-service/model/package-metadata.scm b/guix-data-service/model/package-metadata.scm index 030ad4f..9593b49 100644 --- a/guix-data-service/model/package-metadata.scm +++ b/guix-data-service/model/package-metadata.scm @@ -389,43 +389,39 @@ WHERE packages.id IN ( (insert-package-description-set conn package-description-ids)))))) (define (inferior-packages->package-metadata-ids conn - inferior - packages + package-metadata license-set-ids) - (define package-metadata - (map (lambda (package license-set-id) - (let ((translated-package-descriptions-and-synopsis - (inferior-packages->translated-package-descriptions-and-synopsis - inferior package))) - (list (non-empty-string-or-false - (inferior-package-home-page package)) - (location->location-id - conn - (inferior-package-location package)) - license-set-id - (package-description-data->package-description-set-id - conn - (car translated-package-descriptions-and-synopsis)) - (package-synopsis-data->package-synopsis-set-id - conn - (cdr translated-package-descriptions-and-synopsis))))) - packages - license-set-ids)) - (insert-missing-data-and-return-all-ids conn "package_metadata" - '(home_page location_id license_set_id package_description_set_id package_synopsis_set_id) - (map (match-lambda - ((home-page location-id license-set-id package_description_set_id package_synopsis_set_id) + '(home_page + location_id + license_set_id + package_description_set_id + package_synopsis_set_id) + + (map (match-lambda* + (((home-page + location + package-description-data + package-synopsis-data) + license-set-id) + (list (if (string? home-page) home-page NULL) - location-id + (location->location-id + conn + location) license-set-id - package_description_set_id - package_synopsis_set_id))) - package-metadata) + (package-description-data->package-description-set-id + conn + package-description-data) + (package-synopsis-data->package-synopsis-set-id + conn + package-synopsis-data)))) + package-metadata + license-set-ids) ;; There can be duplicated entires in package-metadata, for example where ;; you have one package definition which interits from another, and just ;; overrides the version and the source, the package_metadata entries for |