Remove redundant postgresql connection when deleting derivations
This commit is contained in:
parent
ebbcf36dc4
commit
1266d3d336
1 changed files with 46 additions and 47 deletions
|
|
@ -512,9 +512,6 @@ DELETE FROM derivations WHERE id = $1"
|
||||||
|
|
||||||
1)))
|
1)))
|
||||||
|
|
||||||
(with-postgresql-connection
|
|
||||||
"data-deletion"
|
|
||||||
(lambda (conn)
|
|
||||||
(define (delete-batch conn)
|
(define (delete-batch conn)
|
||||||
(let* ((derivations
|
(let* ((derivations
|
||||||
(with-time-logging "fetching batch of derivations"
|
(with-time-logging "fetching batch of derivations"
|
||||||
|
|
@ -586,6 +583,8 @@ SET CONSTRAINTS derivations_by_output_details_set_derivation_id_fkey DEFERRED")
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(run-fibers
|
(run-fibers
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
(with-thread-postgresql-connection
|
||||||
|
(lambda (conn)
|
||||||
(let loop ((total-deleted 0))
|
(let loop ((total-deleted 0))
|
||||||
(let ((batch-deleted-count (delete-batch conn)))
|
(let ((batch-deleted-count (delete-batch conn)))
|
||||||
(if (eq? 0 batch-deleted-count)
|
(if (eq? 0 batch-deleted-count)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue