Use advisory locks to avoid deadlocks during data deletion
In the case where multiple data deleting processes end up running at the same time.
This commit is contained in:
parent
ad93a780d3
commit
38b3657013
1 changed files with 8 additions and 0 deletions
|
|
@ -206,6 +206,10 @@ WHERE id IN (
|
|||
(with-postgresql-transaction
|
||||
conn
|
||||
(lambda (conn)
|
||||
(obtain-advisory-transaction-lock
|
||||
conn
|
||||
'delete-revisions-from-branch)
|
||||
|
||||
(delete-from-git-commits conn)
|
||||
(delete-jobs conn)
|
||||
|
||||
|
|
@ -538,6 +542,10 @@ WHERE NOT EXISTS (
|
|||
(with-postgresql-transaction
|
||||
conn
|
||||
(lambda (conn)
|
||||
(obtain-advisory-transaction-lock
|
||||
conn
|
||||
'delete-unreferenced-derivations)
|
||||
|
||||
(exec-query
|
||||
conn
|
||||
"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue