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.
This commit is contained in:
Christopher Baines 2022-03-11 13:07:34 +00:00
parent df4e0a7a61
commit 097e22ab5e
4 changed files with 183 additions and 138 deletions

View file

@ -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