guix-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

01/03: Move the delete-unreferenced-derivations advisory lock


From: Christopher Baines
Subject: 01/03: Move the delete-unreferenced-derivations advisory lock
Date: Tue, 28 Feb 2023 05:52:01 -0500 (EST)

cbaines pushed a commit to branch master
in repository data-service.

commit 1bce38a69dc93eb10b72dd11c8e402b978927653
Author: Christopher Baines <mail@cbaines.net>
AuthorDate: Mon Feb 27 22:48:54 2023 +0000

    Move the delete-unreferenced-derivations advisory lock
    
    To better prevent two processes running at the same time.
---
 guix-data-service/data-deletion.scm | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/guix-data-service/data-deletion.scm 
b/guix-data-service/data-deletion.scm
index 35ea4dc..243dcbc 100644
--- a/guix-data-service/data-deletion.scm
+++ b/guix-data-service/data-deletion.scm
@@ -561,10 +561,6 @@ WHERE NOT EXISTS (
                       (with-postgresql-transaction
                        conn
                        (lambda (conn)
-                         (obtain-advisory-transaction-lock
-                          conn
-                          'delete-unreferenced-derivations)
-
                          (exec-query
                           conn
                           "
@@ -585,6 +581,10 @@ SET CONSTRAINTS 
derivations_by_output_details_set_derivation_id_fkey DEFERRED")
       (lambda ()
         (with-thread-postgresql-connection
          (lambda (conn)
+           (obtain-advisory-transaction-lock
+            conn
+            'delete-unreferenced-derivations)
+
            (let loop ((total-deleted 0))
              (let ((batch-deleted-count (delete-batch conn)))
                (if (eq? 0 batch-deleted-count)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]