2
0
Fork 0
mirror of git://git.savannah.gnu.org/guix/data-service.git synced 2023-12-14 03:23:03 +01:00

Remove redundant postgresql connection when deleting derivations

This commit is contained in:
Christopher Baines 2023-02-14 20:59:21 +00:00
parent ebbcf36dc4
commit 1266d3d336

View file

@ -512,9 +512,6 @@ DELETE FROM derivations WHERE id = $1"
1)))
(with-postgresql-connection
"data-deletion"
(lambda (conn)
(define (delete-batch conn)
(let* ((derivations
(with-time-logging "fetching batch of derivations"
@ -586,6 +583,8 @@ SET CONSTRAINTS derivations_by_output_details_set_derivation_id_fkey DEFERRED")
(lambda ()
(run-fibers
(lambda ()
(with-thread-postgresql-connection
(lambda (conn)
(let loop ((total-deleted 0))
(let ((batch-deleted-count (delete-batch conn)))
(if (eq? 0 batch-deleted-count)