Move the delete-unreferenced-derivations advisory lock
To better prevent two processes running at the same time.
This commit is contained in:
parent
8c2f97eef8
commit
1bce38a69d
1 changed files with 4 additions and 4 deletions
|
|
@ -561,10 +561,6 @@ WHERE NOT EXISTS (
|
||||||
(with-postgresql-transaction
|
(with-postgresql-transaction
|
||||||
conn
|
conn
|
||||||
(lambda (conn)
|
(lambda (conn)
|
||||||
(obtain-advisory-transaction-lock
|
|
||||||
conn
|
|
||||||
'delete-unreferenced-derivations)
|
|
||||||
|
|
||||||
(exec-query
|
(exec-query
|
||||||
conn
|
conn
|
||||||
"
|
"
|
||||||
|
|
@ -585,6 +581,10 @@ SET CONSTRAINTS derivations_by_output_details_set_derivation_id_fkey DEFERRED")
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(with-thread-postgresql-connection
|
(with-thread-postgresql-connection
|
||||||
(lambda (conn)
|
(lambda (conn)
|
||||||
|
(obtain-advisory-transaction-lock
|
||||||
|
conn
|
||||||
|
'delete-unreferenced-derivations)
|
||||||
|
|
||||||
(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