Delete derivations through a channel

Not much different from before, but this will allow parallelising things.
This commit is contained in:
Christopher Baines 2020-10-01 19:14:11 +01:00
parent 614f9888a5
commit fb4c7ecd4c

View file

@ -19,6 +19,7 @@
#:use-module (srfi srfi-1) #:use-module (srfi srfi-1)
#:use-module (ice-9 match) #:use-module (ice-9 match)
#:use-module (squee) #:use-module (squee)
#:use-module (guix-data-service utils)
#:use-module (guix-data-service database) #:use-module (guix-data-service database)
#:use-module (guix-data-service model package-derivation-by-guix-revision-range) #:use-module (guix-data-service model package-derivation-by-guix-revision-range)
#:export (delete-data-for-branch #:export (delete-data-for-branch
@ -393,6 +394,10 @@ DELETE FROM derivations WHERE id = $1"
1))) 1)))
(define conn-channel
(make-postgresql-connection-channel
"data-deletion-thread"))
(with-postgresql-connection (with-postgresql-connection
"data-deletion" "data-deletion"
(lambda (conn) (lambda (conn)
@ -437,8 +442,8 @@ WHERE NOT EXISTS (
1)) 1))
result)) result))
(+ result (+ result
(with-postgresql-transaction (with-postgresql-transaction/through-channel
conn conn-channel
(lambda (conn) (lambda (conn)
(exec-query (exec-query
conn conn